Pagini recente » Cod sursa (job #1900095) | Cod sursa (job #2673823) | Cod sursa (job #2535121) | Cod sursa (job #2159195) | Cod sursa (job #1803308)
#include <iostream>
#include <fstream>
#define mod 1999999973;
using namespace std;
ifstream fin ("lgput.in");
ofstream fout ("lgput.out");
long long lgpow(long long base , long long power)
{
long long yBase = 1;
while (power > 1){
if(power % 2 == 0){
base *= base;
power /= 2;
base %= mod;
}
else{
yBase *= base;
yBase %= mod;
base *= base;
power = (power - 1) / 2;
base %= mod;
}
}
long long Answer = (base * yBase) % mod;
return Answer;
}
int main() {
long long n , putere;
//cin >> n >> putere;
fin >> n >> putere;
//cout << lgpow (n , putere);
fout << lgpow(n , putere);
return 0;
}