Pagini recente » Cod sursa (job #1266935) | Cod sursa (job #896058) | Cod sursa (job #1233998) | Cod sursa (job #2218604) | Cod sursa (job #3136079)
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("lgput.in");
ofstream out("lgput.out");
long long int recPow(unsigned int n, unsigned int p)
{
if (p < 0)
return recPow(1 / n, -p);
if (p == 0)
return 1;
if (p % 2 == 0)
{
return recPow(n * n, p / 2);
cout << 'a';
}
if (p % 2 == 1)
return n * recPow(n * n, p / 2);
}
int main()
{
long long int n;
long long int p;
int pow;
//int x=1999999973;
in >> n >> p;
pow = recPow(n, p);
out << pow % 1999999973;
return 0;
}