Pagini recente » Cod sursa (job #2820725) | Cod sursa (job #2625928) | Cod sursa (job #2431941) | Cod sursa (job #1846175) | Cod sursa (job #1656818)
#include <iostream>
#include <stdio.h>
using namespace std;
long long int N,P;
const int m = 1999999973;
long long int lg(long long int N , long long int P){
if(P==0) return 1;
if(P==1) return N;
if(P%2==0) return (lg(N*N,P/2))%m;
else return (N*lg(N*N,(P-1)/2))%m;
}
int main()
{
FILE *f1,*f2;
f1=fopen("lgput.in","r");
f2=fopen("lgput.out","w");
scanf("%lld",&N);
scanf("%lld",&P);
printf("%lld",lg(N,P));
fclose(f1);
fclose(f2);
}