Pagini recente » Cod sursa (job #1404746) | Cod sursa (job #1443476) | Cod sursa (job #2454953) | Diferente pentru problema/partide intre reviziile 4 si 3 | 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;
}