Pagini recente » Cod sursa (job #1604517) | Cod sursa (job #199829) | Cod sursa (job #232633) | Cod sursa (job #1498262) | Cod sursa (job #1008757)
#include <iostream>
#include <fstream>
#define modulo 1999999973
#define unint unsigned int
using namespace std;
ifstream in("lgput.in");
ofstream out("lgput.out");
unsigned int n,p;
int putere(unint baza, unint exp){
if (exp==1) return n%modulo;
else {
int half=putere(n, int(exp/2));
if (exp % 2 == 0) return ((half%modulo)*(half%modulo))%modulo;
else return ((((half%modulo)*(half%modulo))%modulo)*(baza%modulo))%modulo;
}
}
int main(){
in >> n >> p;
out << putere(n, p)%modulo << "\n";
return 0;
}