Pagini recente » Borderou de evaluare (job #1340227) | Borderou de evaluare (job #993555) | Borderou de evaluare (job #176591) | Borderou de evaluare (job #43307) | Cod sursa (job #2345006)
#include <bits/stdc++.h>
#define ull unsigned long long
using namespace std;
const ull d = 1999999973;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
ull N, P;
int power(ull x, ull n){
if(n == 0){
return 1;
} else {
if(n == 1)
return x % d;
else {
if(n % 2 == 0) {
return power(x * x % d, n / 2) % d;
} else if(n % 2 == 1) {
return (x * power(x * x % d, (n - 1) / 2)) % d;
}
}
}
}
int main(){
fin >> N >> P;
fout << power(N, P);
return 0;
}