Pagini recente » Cod sursa (job #2623928) | Cod sursa (job #1990885) | Cod sursa (job #2786234) | Cod sursa (job #745140) | Cod sursa (job #3234619)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
long long int expo(long long int baza, long long int exp, long long int Mod)
{
long long solutie = 1LL, acc = 0LL;
acc += baza;
for (long long int i = 1; i <= exp; i *= 2)
{
if ((i & exp))
{
solutie *= acc;
if (solutie >= Mod)
solutie %= Mod;
}
acc *= acc;
if (acc >= Mod)
acc %= Mod;
}
return ((long long int)solutie);
}
int main()
{
long long int a, b;
fin >> a >> b;
fout << expo(a, b, 1999999973);
return 0;
}