Pagini recente » Cod sursa (job #718020) | Cod sursa (job #1289383) | Cod sursa (job #378063) | Cod sursa (job #1373449) | 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) );
}