Cod sursa(job #934800)
Utilizator | Data | 31 martie 2013 15:22:58 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.35 kb |
#include <cstdio>
using namespace std;
long pow(long a,long b){
if(b==0) return 1;
else if(b==1) return a;
else return a*pow(a,b-1);
}
int main(){
freopen("lgput.in","r",stdin);
freopen("lgput.out","w",stdout);
long a,b;
scanf("%d%d",&a,&b);
printf("%d",pow(a,b)%1999999973);
return 0;
}