Pagini recente » Cod sursa (job #2657925) | Cod sursa (job #1829945) | Joc pe grid | Cod sursa (job #2707071) | Cod sursa (job #818766)
Cod sursa(job #818766)
#include<fstream>
using namespace std;
// declarations
#define MODUL 1999999973
typedef unsigned int 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;
}