Pagini recente » Cod sursa (job #477142) | Cod sursa (job #210108) | Cod sursa (job #741420) | Cod sursa (job #2281578) | Cod sursa (job #2379226)
#include <iostream>
#include <fstream>
#define MOD 1999999973
using namespace std;
ifstream in("lgput.in");
ofstream out("lgput.out");
long int N,P,o=0;
long int convertToBinary(long int n) {
if (n / 2 != 0) {
convertToBinary(n / 2);
}
o=o*10+n%2;
return o;
}
long int exponentiere(long int N, long int P ) {
long int y=1;
while(P>1) {
if(P%2==0) {
N=N*N%MOD;
P=P/2;
} else
N=N*N%MOD;
y=N*y%MOD;
P=(P-1)>>1;
}
return (N*y)%MOD;
}
int main() {
cin>>N>>P;
cout<<exponentiere(N,P);
return 0;
}