# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
19427 | golala123 | Α (kriii4_P1) | C++98 | 0 ms | 1716 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <stdio.h>
using namespace std;
const int MOD = 1000000007;
long long a, x;
long long f(long long idx){
if (idx == 1) return a;
long long ret = 0;
long long k = f(idx / 2) % MOD;
if (idx % 2 == 1) ret = (((k*k)%MOD) *a )% MOD;
else ret = (k*k) % MOD;
return ret %= MOD;
}
int main(){
cin >> a >> x;
a %= MOD;
cout << f(x) % MOD;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |