Submission #19610

#TimeUsernameProblemLanguageResultExecution timeMemory
19610chan492811Α (kriii4_P1)C++98
100 / 100
0 ms1084 KiB
#include <cstdio> #include <algorithm> #define mod 1000000007 #define ll long long using namespace std; ll table[100]; void make_table(ll a){ ll i; table[0]=a%mod; for(i=1;i<100;i++) table[i]=(table[i-1]*table[i-1])%mod; } int main(){ ll i,a,s,res=1,now; scanf("%lld %lld",&a,&s); make_table(a); now=1; for(i=0;s;i++){ if(s&now) res*=table[i],res%=mod,s-=now; now*=2; } printf("%lld",res); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...