Pagini recente » Cod sursa (job #2703386) | Cod sursa (job #3250995) | Cod sursa (job #576884) | Cod sursa (job #1799818) | Cod sursa (job #1608767)
#include <iostream>
#include <fstream>
#define modulo 1999999973
using namespace std;
ifstream f("lgput.in");
ofstream g("lgput.out");
long long pow(int a, int b)
{
if (b == 0)
return (1);
if (b == 1)
return (a);
if (b % 2 == 1)
return (a * pow(a * a, b - 1));
else
return (pow(a * a, b / 2));
}
long long poww(int a, int b)
{
long long s = 1;
while (b > 0)
{
if (b % 2)
{
s *= a;
b--;
}
a *= a;
b /= 2;
}
return (s);
}
int main()
{
int a, b;
f >> a >> b;
g << poww(a, b) % modulo;
return 0;
}