Pagini recente » Cod sursa (job #2231288) | Monitorul de evaluare | Cod sursa (job #411363) | Cod sursa (job #1396912) | Cod sursa (job #1183094)
#include <fstream>
#include <iostream>
using namespace std;
int n, p;
long long exp(long long x, long long n)
{
if (n == 0)
return 1;
if (n == 1)
return x;
if (n % 2 == 0)
return exp(x * x, n / 2) % 1999999973;
if (n % 2 != 0)
return (x * (exp(x * x, (n - 1) / 2) % 1999999973)) % 1999999973;
}
int main()
{
ifstream cin("lgput.in");
ofstream cout("lgput.out");
cin >> n >> p;
cout << exp(n, p);
return 0;
}