Cod sursa(job #359607)
Utilizator | Data | 27 octombrie 2009 20:49:47 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.33 kb |
#include<stdio.h>
long long b,e,p,m;
void read(),solve();
int main()
{
read();
solve();
return 0;
}
void read()
{
freopen("lgput.in","r",stdin);
freopen("lgput.out","w",stdout);
scanf("%lld%lld",&b,&e);
}
void solve()
{
m=1999999973;
p=1;
while(e){if(e&1)p=(p*b)%m;b=(b*b)%m;e>>=1;}
printf("%lld\n",p);
}