Cod sursa(job #1968570)
| Utilizator | Data | 17 aprilie 2017 19:11:25 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.32 kb |
#include <cstdio>
#define MOD 1999999973
using namespace std;
int a,b,x=1;
int main()
{
freopen("lgput.in","r",stdin);
freopen("lgput.out","w",stdout);
scanf("%d%d",&a,&b);
while(b)
{
if(b%2) x=(x*a)%MOD;
a=(a*a)%MOD;
b=b/2;
}
printf("%d",x);
return 0;
}
