Pagini recente » Cod sursa (job #1468047) | Statisticile problemei Nu stiu | Cod sursa (job #597130) | Cod sursa (job #1486739) | Cod sursa (job #2870076)
#include <iostream>
#include <fstream>
using namespace std;
const string filename = "lgput";
ifstream fin(filename + ".in");
ofstream fout(filename + ".out");
const int mod = 1999999973;
int n, put;
int lgput(int x, int p)
{
if(p == 1)
return x;
if(p % 2 == 0)
{
int k = lgput(x, p / 2);
return (1LL * k * k) % mod;
}
if(p % 2 == 1)
return (1LL * x * lgput(x, p - 1)) % mod;
}
int main()
{
fin >> n >> put;
fout << lgput(n, put);
return 0;
}