Pagini recente » Cod sursa (job #1843066) | Cod sursa (job #1433631) | Cod sursa (job #1023661) | Cod sursa (job #823161) | Cod sursa (job #2223419)
#include <stdio.h>
#include <stdlib.h>
#define IMPART 1999999973
long long computePower(long long n,long long p){
if(p==1) return n;
else if(p%2==0) return (computePower((n*n)%IMPART,p/2))%IMPART;
else return (n*computePower((n*n)%IMPART,(p-1)/2))%IMPART;
}
int main()
{
FILE*fin,*fout;
fin = fopen("lgput.in" ,"r");
fout = fopen("lgput.out" ,"w");
long long n,p;
fscanf(fin, "%lld%lld" ,&n,&p);
fprintf(fout, "%lld\n" ,computePower(n,p));
fclose(fin);
fclose(fout);
return 0;
}