Pagini recente » Cod sursa (job #316564) | Cod sursa (job #3032290) | Cod sursa (job #2202325) | Cod sursa (job #1207291) | Cod sursa (job #2255013)
#include <fstream>
using namespace std;
typedef unsigned long long ull;
const ull Z = 1999999973;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
ull powerFunction(ull n, ull p)
{
if(p==0)
return 1;
if(p%2==1)
return (powerFunction(n,p-1) * n)%Z;
ull halfPower = (powerFunction(n,p/2))%Z;
return (halfPower * halfPower)%Z;
}
int main()
{
ull N, P;
fin >> N >> P;
fout << powerFunction(N%Z,P);
fin.close();
fout.close();
return 0;
}