Pagini recente » Cod sursa (job #1281546) | Cod sursa (job #2105679) | Cod sursa (job #9433) | Cod sursa (job #2623876) | Cod sursa (job #2292372)
#include <iostream>
#include <fstream>
using namespace std;
const int N = 1999999973;
long long int lgput(long long int exp, long long int x)
{
long long int sol = 1;
while (x)
{
if (x & 1)
sol = sol * exp %N;
exp = exp * exp % N;
x = x >> 1;
}
return sol;
}
int main()
{
ifstream in ("lgput.in");
ofstream out ("lgput.out");
int exponent, baza;
in >> exponent >> baza;
out << lgput ( exponent, baza );
in.close();
out.close();
return 0;
}