Pagini recente » Cod sursa (job #459826) | Cod sursa (job #2285157) | Cod sursa (job #1952884) | Cod sursa (job #1648805) | Cod sursa (job #1008745)
#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;
else {
int half=putere(n, int(exp/2));
if (exp % 2 == 0) return (half*half)%modulo;
else return (half*half*baza)%modulo;
}
}
int main(){
in >> n >> p;
out << putere(n, p) << "\n";
return 0;
}