Pagini recente » Cod sursa (job #1490812) | Cod sursa (job #15658) | Cod sursa (job #541325) | Cod sursa (job #2140228) | Cod sursa (job #933607)
Cod sursa(job #933607)
#include<cstdio>
using namespace std;
FILE *in,*out;
const int NUL = 1999999973;
int putere(int a, int b){
if(b==1)
return a;
if(b%2==0)
return putere(a*a%NUL, b/2)%NUL;
if(b%2==1)
return a* putere(a*a%NUL, (b-1)/2) %NUL;
}
int main(){
in=fopen("lgput.in","r");
out=fopen("lgput.out","w");
int a,b;
fscanf(in,"%d%d",&a,&b);
int sol=putere(a,b);
fprintf(out,"%d",sol);
return 0;
}