Cod sursa(job #781038)
| Utilizator | Data | 22 august 2012 23:54:09 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 30 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.43 kb |
#include <cstdio>
#include <algorithm>
using namespace std;
#define Mod 1999999973
typedef long long ll;
ll n,k;
ll pow(int k){
if(k == 1)return n; else
{
ll v = pow(k/2);
if(k%2) return (n*(v*v)%Mod)%Mod; else
return (v*v)%Mod;
}
}
int main(){
freopen("lgput.in","r",stdin);
freopen("lgput.out","w",stdout);
scanf("%lld %lld",&n,&k);
printf("%lld\n",pow(k));
return 0;
}
