Pagini recente » Cod sursa (job #945664) | Cod sursa (job #730928) | Cod sursa (job #2137929) | Cod sursa (job #2070890) | Cod sursa (job #178747)
Cod sursa(job #178747)
#include<stdio.h>
#define REST 1999999973
typedef long long LL;
LL n,p,sol;
LL functie( LL x )
{
if(x==1) return n % REST;
else
if(x%2==0) { sol=functie(x/2) % REST; return (sol*sol) % REST; }
else return ( (functie(x-1) % REST) * (n % REST) ) % REST;
}
main()
{
freopen("lgput.in","r",stdin);
freopen("lgput.out","w",stdout);
scanf("%lld %lld", &n, &p);
printf("%lld\n", functie(p) );
}