Pagini recente » Cod sursa (job #110871) | Cod sursa (job #2986838) | Cod sursa (job #2705991) | Cod sursa (job #3176192) | Cod sursa (job #1563798)
#include <iostream>
#include <fstream>
#define p 1999999973
using namespace std;
int a,b;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
long long int Ridicare_la_putere(long long int x,long long int n)
{
if(n==0)return 1;
else if(n==1) return x%p;
else if(n%2==0) return Ridicare_la_putere((x*x)%p,n/2)%p;
else return ((x%p)*(Ridicare_la_putere((x*x)%p,(n-1)/2)%p))%p;
}
int main()
{
long long int a, putere;
fin>>a>>putere;
fout<<Ridicare_la_putere(a,putere)%p;
return 0;
}