Pagini recente » Monitorul de evaluare | Cod sursa (job #409791) | Cod sursa (job #2489591) | Cod sursa (job #413091) | Cod sursa (job #1246887)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
const int m = 1999999973;
unsigned int n, p;
long long x, sol = 1;
int main()
{
fin >> n >> p;
x = n;
for ( unsigned int i = 0; (1<<i) <= p; ++ i)
{
if ( ((1<<i) & p) )
sol= (sol * x) % m;
x=(x * x) % m;
}
fout << sol;
fin.close();
fout.close();
return 0;
}