Pagini recente » Cod sursa (job #1693564) | Cod sursa (job #836468) | Cod sursa (job #772649) | Cod sursa (job #1656645) | Cod sursa (job #1510048)
//#include <fstream>
//using namespace std;
//ifstream in("lgput.in");
//ofstream out("lgput.out");
//int main()
//{
// long long N,P,r=1;
// in>>N>>P;
// while(P!=1)
// {
// if(P%2==1){
// r=(r*N)%1999999973;
// P=P-1;
// }
// else
// {
// P=P/2;
// N=(N*N)%1999999973;
// }
// }
// out<<(r*N)%1999999973;
//
// return 0;
//}
#include <fstream>
using namespace std;
ifstream in("lgput.in");
ofstream out("lgput.out");
int main()
{ int n,p,r=1,gigi;
in>>n>>p;
while(p!=1)
{
if(p%2==0)
{
p=p/2;
n=(n*n)%1999999973;
}
else
{
r=(r*n)%1999999973;
p--;
}
}
gigi=(r*n)%1999999973;
out<<gigi;
}