Pagini recente » Cod sursa (job #2037656) | Cod sursa (job #472760) | Monitorul de evaluare | Cod sursa (job #2079790) | Cod sursa (job #2280351)
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
ifstream f ("lgput.in");
ofstream g ("lgput.out");
long long int k=1999999973;
long long int exp(long long int x,long long int y)
{
if(y==0)
{
return 1;
}
if(y%2)
{
return ((long long)x*(long long)(exp(x*x,(y-1)/2)));
}
return ((long long)exp(x*x,y/2));
}
int main()
{
long long int n,p;
f>>n>>p;
cout<<"Varianta mea: "<<(exp(n,p))%k<<endl;
return 0;
}