Pagini recente » Cod sursa (job #275542) | Cod sursa (job #2729161) | Cod sursa (job #49241) | Cod sursa (job #2984139) | Cod sursa (job #1241136)
#include <stdio.h>
#define mod 1999999973
using namespace std;
long long exp(long long x, long long p)
{
if(!p)return 1;
if(p%2==0)return exp(x*x%mod,p/2)%mod;
if(p%2!=0)return (x%mod)*(exp(x*x%mod,p/2)%mod)%mod;
}
int main()
{
long long n,p;
FILE *f1=fopen("lgput.in","r"),*f2=fopen("lgput.out","w");
fscanf(f1,"%lld%lld",&n,&p);
fprintf(f2,"%lld",exp(n,p));
return 0;
}
//Our greatest weakness lies in giving up. The most certain way to succeed is always to try just one more time.