Submission #6867751


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

ll N,M,P;

ll beki(ll a, ll b) {
    if(b == 0) return 1;
    ll ans = beki(a * a % mod, b / 2);
    if(b % 2 == 1) ans = ans * a % mod;
    return ans;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

    cin >> N >> M >> P;
    cout << beki(N,P) << endl;
    return 0;
}

Submission Info

Submission Time
Task B - n^p mod m
User MiyanagaTeru
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1516 Byte
Status
Exec Time 2 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 100
Status
× 2
× 27
Set Name Test Cases
Sample
All 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
001.txt 1 ms 256 KB
002.txt 1 ms 256 KB
003.txt 1 ms 256 KB
004.txt 1 ms 256 KB
005.txt 1 ms 256 KB
006.txt 1 ms 256 KB
007.txt 1 ms 256 KB
008.txt 1 ms 256 KB
009.txt 1 ms 256 KB
010.txt 1 ms 256 KB
011.txt 1 ms 256 KB
012.txt 1 ms 256 KB
013.txt 1 ms 256 KB
014.txt 2 ms 256 KB
015.txt 2 ms 256 KB
016.txt 2 ms 256 KB
017.txt 2 ms 256 KB
018.txt 2 ms 256 KB
019.txt 2 ms 256 KB
020.txt 1 ms 256 KB
021.txt 2 ms 256 KB
022.txt 1 ms 256 KB
023.txt 1 ms 256 KB
024.txt 2 ms 256 KB
025.txt 1 ms 256 KB
026.txt 2 ms 256 KB
027.txt 2 ms 256 KB
sample_01.txt 2 ms 256 KB
sample_02.txt 2 ms 256 KB