Cod sursa(job #1789140)
| Utilizator | Data | 26 octombrie 2016 18:44:36 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.41 kb |
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
freopen("lgput.in", "r", stdin);
freopen("lgput.out", "w", stdout);
unsigned long long a,b,i,k,p=1;
scanf("%lld %lld",&a,&b);
while(b)
{
if(b%2==1)
p=p*a%1999999973;
a=a*a%1999999973;
b/=2;
}
printf("%lld",p);
return 0;
}
