Cod sursa(job #1621363)
| Utilizator | Data | 29 februarie 2016 18:39:43 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.51 kb |
#include <stdio.h>
using namespace std;
#define ll long long unsigned
#define pb push_back
#define mp make_pair
const int MOD = 1999999973;
ll lgpow(ll b, ll e){
ll sol = 1;
while(e){
if(e&1){
sol = (sol*b)%MOD;
}
b = (b*b)%MOD;
e >>= 1;
}
return sol;
}
int main(){
ll n,p;
freopen("lgput.in", "r", stdin);
freopen("lgput.out", "w", stdout);
scanf("%lld %lld",&n,&p);
printf("%lld",lgpow(n,p));
return 0;
}
