Pagini recente » Cod sursa (job #2493591) | Cod sursa (job #777074) | Cod sursa (job #117955) | Cod sursa (job #1341465) | 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;
}