Pagini recente » Cod sursa (job #169459) | Cod sursa (job #798526) | Cod sursa (job #335994) | Cod sursa (job #257333) | Cod sursa (job #2878336)
#include <iostream>
#include <fstream>
using namespace std;
ifstream f ("lgput.in");
ofstream g ("lgput.out");
const int MOD = 1999999973;
int LogExp(long long n, long long p)
{
long long ans = 1;
while (p != 0)
{
if (p % 2 == 1)
{
ans = (ans * n) % MOD;
}
n = (n * n) % MOD;
p = p / 2;
}
return ans;
}
int main()
{
long long n, p;
f >> n >> p;
g << LogExp(n, p);
}