Pagini recente » Diferente pentru problema/nodiv intre reviziile 3 si 4 | Diferente pentru problema/hamster intre reviziile 29 si 30 | Cod sursa (job #2020725) | Cod sursa (job #1191873) | Cod sursa (job #2627887)
#include <fstream>
using namespace std;
ifstream fin ("lgput.in");
ofstream fout ("lgput.out");
long long nr, p;
int mod = 1999999973;
long long lgput (long long a, long long b) {
long long r = 1;
while (b > 0) {
if (b % 2 == 1)
r = (r * a) % mod;
a = (a * a) % mod;
b /= 2;
}
return r % mod;
}
int main()
{
fin >> nr >> p;
fout << lgput (nr, p);
return 0;
}