제출 #19568

#제출 시각아이디문제언어결과실행 시간메모리
19568thebarbershopΑ (kriii4_P1)C++14
0 / 100
0 ms1084 KiB
#include <cstdio> int main() { unsigned long long int A, X; const unsigned long long int MOD = 1000000007; unsigned long long int Ax[65] = {0}; // Ax[i] = A^(2^i) scanf("%I64u%I64u", &A, &X); Ax[0] = A; int i, j; unsigned long long int t = X; int bit = 0; while(t) { bit++; t /= 2; } for(i = 1; i < bit; i++) { Ax[i] = (Ax[i-1]%MOD)*(Ax[i-1]%MOD); Ax[i] %= MOD; } unsigned long long int result = 1; for(j = 0; j < i; j++) { if(X&1) result = (result%MOD) * (Ax[j]%MOD); result %= MOD; X /= 2; } printf("%I64u\n", result%MOD); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...