Submission #19428

#TimeUsernameProblemLanguageResultExecution timeMemory
19428golala123Α (kriii4_P1)C++98
100 / 100
0 ms1720 KiB
#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 = (((f(idx / 2) % MOD*f(idx / 2) % MOD) % MOD) *a) % MOD; else ret = (f(idx / 2) % MOD*f(idx / 2) % MOD) % MOD; return ret %= MOD; } int main(){ cin >> a >> x; a %= MOD; cout << f(x) % MOD; }
#Verdict Execution timeMemoryGrader output
Fetching results...