Pagini recente » testere21 | Cod sursa (job #1353574) | Cod sursa (job #3152040) | Cod sursa (job #2685557) | Cod sursa (job #1789966)
#include <fstream>
using namespace std;
unsigned int lgput(unsigned int x, unsigned int n) {
if (n == 0) {
return 1;
} else if (n == 1) {
return x;
} else if (n % 2 == 0) {
return lgput(x * x, n / 2);
} else {
return x * lgput(x * x, (n - 1) / 2);
}
}
int main()
{
ifstream fin("lgput.in");
ofstream fout("lgput.out");
unsigned int N, P, res;
fin >> N >> P;
res = lgput(N, P);
res %= 1999999973;
fout << res;
fin.close();
fout.close();
return 0;
}