Pagini recente » Cod sursa (job #1962580) | Cod sursa (job #74620) | Cod sursa (job #1744933) | Cod sursa (job #1993356) | Cod sursa (job #2175736)
#include <fstream>
std::ifstream f("lgput.in");
std::ofstream g("lgput.out");
constexpr int mod = 1999999973;
using uint64 = unsigned long long;
uint64 x, y;
uint64 Pow(uint64 x, uint64 y)
{
if (x == 1)
return 1;
else if (x == 0)
return 0;
else if (y == 1)
return x;
else if (y % 2 == 1) {
uint64 aux = Pow(x, (y / 2));
return (((aux * aux) % mod) * x) % mod;
}
else {
uint64 aux = Pow(x, (y / 2));
return (aux * aux) % mod;
}
}
int main(int argc, char * argv[])
{
f >> x >> y;
g << Pow(x, y);
return 0;
}