Pagini recente » Cod sursa (job #602228) | Cod sursa (job #3179028) | Cod sursa (job #1430959) | Cod sursa (job #2999029) | Cod sursa (job #715707)
Cod sursa(job #715707)
#include<cstdio>
typedef unsigned int uint;
typedef unsigned long long ull;
const uint _MOD = 1999999973;
uint pow(uint baza, uint putere)
{
if (putere==1) return baza % _MOD;
else
{
if (putere%2==0)
return (ull) pow(baza, putere/2) * (ull) pow(baza, putere/2) % (ull) _MOD;
else
return ( (ull) (pow(baza, putere/2) * (ull) pow(baza, putere/2) % (ull) _MOD) * (ull) pow(baza, 1)) % (ull) _MOD;
}
}
int main()
{
freopen("lgput.in", "r", stdin);
freopen("lgput.out", "w", stdout);
uint B, P;
scanf("%u %u",&B,&P);
printf("%u", pow(B, P));
return 0;
}