Pagini recente » Cod sursa (job #2298274) | Cod sursa (job #1694550) | Cod sursa (job #1894165) | Cod sursa (job #900873) | Cod sursa (job #1730661)
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("lgput.in");
ofstream g("lgput.out");
long long exp_by_squaring(long long x,int n)
{
if(n<0)
return exp_by_squaring(1/x,-n);
else
{
if(n==0)
return 1;
else
{
if(n==1)
return x;
else
{
if(n%2==0)
return exp_by_squaring(x*x,n/2);
else
return x*exp_by_squaring(x*x,(n-1)/2);
}
}
}
}
int main()
{
int a,b;
f>>a>>b;
g<<exp_by_squaring(a,b)%1999999973;
f.close();
g.close();
return 0;
}