Pagini recente » Cod sursa (job #2812613) | Cod sursa (job #2499881) | Cod sursa (job #1890938) | Cod sursa (job #2984050) | 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;
}