Pagini recente » Diferente pentru runda/acm_practice2 intre reviziile 4 si 3 | Cod sursa (job #1020257) | Cod sursa (job #1927580) | Diferente pentru problema/perfect2 intre reviziile 19 si 29 | Cod sursa (job #1635390)
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
int main()
{
ifstream in("lgput.in");
ofstream out("lgput.out");
long long n,p,sol=1;
int m=1999999973;
in>>n>>p;
for(int i=0;(1<<i)<=p;i++){
if(((1<<i)&p)>0){
sol=(sol*n)%m;
}
n=(n*n)%m;
}
out<<sol;
return 0;
}