Pagini recente » Cod sursa (job #2715847) | Cod sursa (job #464806) | Cod sursa (job #680884) | Cod sursa (job #2620055) | Cod sursa (job #2919350)
#include <fstream>
#include <iostream>
using namespace std;
int m = 1999999973;
int pow(long long n, long long p){
if(p == 0)
return 1;
int lsb = p % 2;
int partial = (pow(n, p/2) * pow(n, p/2)) % m;
if(lsb == 0)
return partial;
else
return (n * partial) % m;
}
int main(){
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int n, p;
fin >> n >> p;
fout << pow(n, p);
}