Submission #19513

# Submission time Handle Problem Language Result Execution time Memory
19513 2016-02-24T14:56:10 Z metadata Α (kriii4_P1) C++14
0 / 100
0 ms 1080 KB
#include<cstdio>
#define MOD 1000000007

long long mod_bp[65];
long long A,X,r;

int main(){
    scanf("%d %d",&A,&X);
    mod_bp[0]=A%MOD;
    int i;
    for(i=1;(1<<i)<=X;i++){
        mod_bp[i]=(mod_bp[i-1]*mod_bp[i-1])%MOD;
    }
    for(i=0,r=1;(1<<i)<=X;i++){
        if((1<<i)&X){
            r*=mod_bp[i];
            r%=MOD;
        }
    }
    printf("%lld",r);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 1080 KB SIGSEGV Segmentation fault
2 Halted 0 ms 0 KB -