Pagini recente » Cod sursa (job #1904455) | Cod sursa (job #2454368) | Cod sursa (job #2610443) | Cod sursa (job #1939094) | Cod sursa (job #183342)
Cod sursa(job #183342)
#ifdef WIN32
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <cstdio>
#define MOD 1999999973
int main()
{
freopen("lgput.in", "rt", stdin);
freopen("lgput.out", "wt", stdout);
int n, p;
scanf("%d%d", &n, &p);
int sol = 1, r = n;
for (int i = 0; p; i++)
{
if (p & (1 << i))
{
sol = (sol * r) % MOD;
p -= 1 << i;
}
r = (r * r) % MOD;
}
printf("%d\n", sol);
return 0;
}