Pagini recente » Cod sursa (job #858852) | Cod sursa (job #2192022) | **** | Cod sursa (job #703050) | Cod sursa (job #1773580)
#include <fstream>
using namespace std;
int modularPow(unsigned long long base, unsigned long long exp, int mod)
{
int result = 1;
while (exp)
{
if (exp & 1)
result = ((result % mod) * (base % mod)) % mod;
base = ((base % mod) * (base % mod)) % mod;
exp >>= 1;
}
return result;
}
int main()
{
unsigned long long N, P;
ifstream f("lgput.in");
f >> N >> P;
f.close();
ofstream g("lgput.out");
g << modularPow(N, P, 1999999973);
g.close();
return 0;
}