Pagini recente » Cod sursa (job #1628676) | Cod sursa (job #461207) | Cod sursa (job #2465677) | Cod sursa (job #2862488) | Cod sursa (job #2539977)
#include <fstream>
using namespace std;
ifstream in("lgput.in");
ofstream out("lgput.out");
int n, exp;
int quick_power(int base, int exponent)
{
int result = 1;
while(exponent > 1)
{
if(exponent % 2 == 0)
{
exponent /= 2;
base *= base;
}
else
{
exponent = exponent / 2 - 1;
result *= base;
base *= base;
}
}
return result * base;
}
int main()
{
in >> n >> exp;
out << quick_power(n, exp) % 1999999973;
return 0;
}