Pagini recente » Cod sursa (job #2492158) | Cod sursa (job #1934572) | Cod sursa (job #1280483) | Cod sursa (job #119698) | Cod sursa (job #1679473)
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("lgput.in" );
ofstream g("lgput.out");
#define MOD(x) ( x%1999999973!=0?x%1999999973:1 )
int N, P;
int square(int x) { return x*x; }
long long FastPow(int base, int exponent) {
if ( exponent == 0 ) return 1;
if ( exponent == 1 ) return base;
if ( exponent%2 )
return MOD(base * square(FastPow(base, (exponent-1) / 2)));
else
return MOD(square(FastPow(base, exponent/2)));
}
int main() {
f >> N >> P;
g << FastPow(N, P);
}