Pagini recente » Monitorul de evaluare | Cod sursa (job #188489) | Cod sursa (job #2830664) | Monitorul de evaluare | Cod sursa (job #3299156)
#include<iostream>
#include<fstream>
#define MOD 1999999973
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
long long fast_exponentiation(long long x, int n){
if(n == 0) return 1;
else if(n % 2 == 0) return (fast_exponentiation((x * x) % MOD, n / 2) % MOD);
else return (x * fast_exponentiation((x * x) % MOD, n / 2)) % MOD;
}
int main(){
long long n;
int p;
fin >> n >> p;
fout << fast_exponentiation(n, p);
fin.close();
fout.close();
return 0;
}