Cod sursa(job #1700327)
| Utilizator | Data | 10 mai 2016 00:36:49 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.46 kb |
#include <cstdio>
using namespace std;
typedef long long i64;
const int MOD = 1999999973;
int exp(i64 b, i64 e) {
i64 ans = 1;
while(e) {
if(e&1)
ans = ans * b % MOD;
e>>=1;
b=b*b%MOD;
}
return int(ans);
}
int main(void) {
FILE *fi = fopen("lgput.in","r");
FILE *fo = fopen("lgput.out","w");
int b, e;
fscanf (fi,"%d%d",&b,&e);
fprintf(fo,"%d\n",exp(b, e));
return 0;
}
