Pagini recente » Cod sursa (job #11218) | Cod sursa (job #106814) | Cod sursa (job #2497964) | Cod sursa (job #480150) | Cod sursa (job #818767)
Cod sursa(job #818767)
#include<fstream>
using namespace std;
// declarations
#define MODUL 1999999973
typedef unsigned long long intPoz;
intPoz logPow(intPoz n, intPoz p){
intPoz temp;
if(!p) return 1;
if(p%2) return (n*logPow(n,p-1))%MODUL;
temp = logPow(n,p/2)%MODUL;
return temp*temp%MODUL;
}
int main()
{
intPoz N,P;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
fin >> N >> P;
fout << logPow(N,P);
fin.close();
fout.close();
return 0;
}