Pagini recente » Cod sursa (job #600556) | Clasament tema1 | Cod sursa (job #799395) | Cod sursa (job #1095180) | Cod sursa (job #3131602)
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("lgput.in");
ofstream out("lgput.out");
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);
if (p % 2 == 1)
return n * recPow(n * n, p / 2);
}
int main()
{
float n;
int p;
int pow;
int x=1999999973;
in >> n >> p;
pow = recPow(n, p);
out << pow%x;
return 0;
}