Pagini recente » Cod sursa (job #1022550) | Cod sursa (job #1609176) | Cod sursa (job #2044849) | Istoria paginii runda/fwdf/clasament | Cod sursa (job #2943691)
#include <iostream>
#include <fstream>
using namespace std;
const int M = 1999999973;
int putere(long long int a, int n)
{
int p = 1;
while (n != 0)
{
int cifb = n % 2;
if (cifb != 0)
p = (long long) p * a % M;
a = a * a % M;
n /= 2;
}
return p;
}
int main()
{
ifstream fin("lgput.in");
ofstream fout("lgput.out");
long long int n, p;
fin >> n >> p;
fout << putere(p, n) << endl;
return 0;
}