Pagini recente » Diferente pentru problema/hidden_points intre reviziile 42 si 41 | Cod sursa (job #162535) | Cod sursa (job #91724) | Cod sursa (job #822633) | Cod sursa (job #3167485)
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("lgput.in");
ofstream fout ("lgput.out");
int main()
{
long long n,p,L = 1999999973;
fin >> n >> p;
while (p>0){
if (p==0){
fout << 1;
break;
}
if (p==1) break;
if (p%2==0){
n *= n;
n = n%L;
p /= 2;
}else{
p += 1;
p /= 2;
n *= n;
n = n%L;
}
}
fout << n;
return 0;
}