Pagini recente » Cod sursa (job #1414121) | Cod sursa (job #2590301) | Cod sursa (job #1581506) | Cod sursa (job #2659737) | Cod sursa (job #2906803)
#include<iostream>
#include<fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
long long exp(int x, int n)
{
if(n < 0)
return exp(1/x, -n);
else if(n == 0)
return 1;
else if(n % 2 == 0)
return exp(x * x, n / 2);
else if(n % 2 == 1)
return x * exp(x * x, (n - 1)/2);
}
int main()
{
long long n, p;
fin >> n >> p;
fout << exp(n, p) % 1999999973;
return 0;
}