Cod sursa(job #838900)
Utilizator | Data | 20 decembrie 2012 20:15:18 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.32 kb |
#include <stdio.h>
int main()
{
int a,b;
long long p=1;
freopen("putere.in","r",stdin);
freopen("putere.out","w",stdout);
scanf("%d %d",&a,&b);
while(b!=0)
{
if(b%2==1) p*=a%1999999973;
a*=a%1999999973;
b/=2;
}
printf("%lld",p);
return 0;
}