Cod sursa(job #1171442)
Utilizator | Data | 15 aprilie 2014 19:09:12 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.38 kb |
#include <cstdio>
#define mod 1999999973
using namespace std;
int n, e, i, t,p;
int main()
{
freopen("lgput.in", "r", stdin);
freopen("lgput.out", "w", stdout);
scanf("%d%d", &n, &e);
p=n;
t=1;
while(e>0)
{
if((e&1)==1)
t=(1LL*t*p)%mod;
p=(1LL*p*p)%mod;
e>>=1;
}
printf("%d", t);
return 0;
}