Pagini recente » Cod sursa (job #1569548) | Cod sursa (job #1875038) | Diferente pentru documentatie/acces-email intre reviziile 3 si 4 | Cod sursa (job #1080739) | Cod sursa (job #1157820)
#include <cstdio>
using namespace std;
long long a,b;
int log(long long x,long long n)
{
if(n==0)
return 1;
if(n==1)
return x%1999999973;
if(n%2==0)
return log(((x*x)%1999999973),n/2)%1999999973;
if(n%2==1)
return log(((x*x)%1999999973),(n-1)/2)*x%1999999973;
}
int main()
{
freopen("lgput.in","r",stdin);
freopen("lgput.out","w",stdout);
scanf("%d%d",&a,&b);
printf("%d",log(a,b));
return 0;
}