Submission #19595

#TimeUsernameProblemLanguageResultExecution timeMemory
19595panda959595Α (kriii4_P1)C++98
100 / 100
0 ms1716 KiB
#include <string> #include <cmath> #include <iostream> #include <cstdio> #include <algorithm> #include <vector> #include <list> #include <stdio.h> #include <string.h> using namespace std; int main() { long long a, b; int k; cin >> a >> b; bool num[100]; long long A[100]; a %= 1000000007; A[0] = a; for (int i = 0; i < 100; i++) { if (i > 0) { A[i] = A[i - 1] * A[i - 1]; A[i] %= 1000000007; } num[i] = false; if (b == 0) { k = i; break; } if (b % 2 == 1) num[i] = true; b /= 2; } long long answer = 1; int p; for (int i = 0; i < k; i++) { if (num[i]) { answer *= A[i]; answer %= 1000000007; } } cout << answer << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...