Pagini recente » Cod sursa (job #198256) | Cod sursa (job #1604408) | Cod sursa (job #50509) | Cod sursa (job #675135) | Cod sursa (job #2169310)
#include <iostream>
#include <fstream>
#define val 1999999973
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int putere(int n,int p)
{
int x;
if(p==1)
return n%val;
else
{
if(p%2==0)
{
x=putere(n,p/2);
return ((x%val)*(x%val))%val;
}
else
{
x=putere(n,p/2);
return ((((x%val)*(x%val))%val)*(n%val))%val;
}
}
}
int main()
{
int n,p;
fin>>n>>p;
fout<<putere(n,p);
}