Pagini recente » Cod sursa (job #1189302) | Cod sursa (job #1209095) | Cod sursa (job #2187044) | Cod sursa (job #1750219) | Cod sursa (job #1175985)
#include <stdio.h>
const int mod = 1999999973;
int logp(int n, int p) {
int x;
if (p == 1)
return n;
if (p == 0)
return 1;
x = logp(n, p / 2);
if (p % 2 == 0) {
return (x * x) % mod;
}
return (x * x * n) % mod;
}
int main()
{
freopen("lgput.in", "r", stdin);
freopen("lgput.out", "w", stdout);
int n, p;
scanf("%d%d", &n, &p);
printf("%d", logp(n, p));
return 0;
}