Pagini recente » Cod sursa (job #1897673) | Cod sursa (job #6109) | Cod sursa (job #1087994) | Cod sursa (job #1680576) | Cod sursa (job #1698684)
#include <fstream>
#include <iostream>
std::ifstream f("lgput.in");
std::ofstream g("lgput.out");
using big = long long;
const big toDiv = 1999999973;
big pow(big n, big p){
if(p == 0){
return 1;
}
if(p == 1){
return n % toDiv;
}
if(p % 2 == 0){
return pow(n * n , p / 2) % toDiv;
}
return (n * pow(n * n , p / 2)) % toDiv ;
}
int main(){
big N, P;
f >> N >> P;
g << pow(N,P);
f.close();
g.close();
return 0;
}