Pagini recente » Cod sursa (job #3038596) | Cod sursa (job #2406905) | Cod sursa (job #1441908) | Cod sursa (job #1663981) | Cod sursa (job #2608460)
#include <fstream>
using namespace std;
long long int n,p,rez=1,a;
const int nr = 1999999973;
int ridput(long long int n,long long int p)
{
long long int a = n;
long long int rez=1;
for(int i=0; (1<<i) <= p; i++)
{
if(((1<<i) & p))
{
rez=(rez*a)%nr;
}
a=(a*a)%nr;
}
return rez;
}
int main()
{
ifstream cin("lgput.in");
ofstream cout("lgput.out");
cin>>n>>p;
cout<<ridput(n,p);
return 0;
}