Pagini recente » Cod sursa (job #2720284) | Cod sursa (job #3129560) | Cod sursa (job #1931942) | Cod sursa (job #2242736) | Cod sursa (job #1098647)
/* Ridicare la putere folosind exponentiere logaritmica */
#include <fstream>
using namespace std;
#define MOD 1999999973
long long N, P, R;
void Pow(long long P)
{
if (P == 0)
{
R = 1;
return;
}
else
{
Pow(P / 2);
if (P % 2)
{
R = (R * R * N) % MOD;
}
else
{
R = (R * R) % MOD;
}
}
}
int main()
{
ifstream f("lgput.in");
ofstream g("lgput.out");
f >> N >> P;
Pow(P);
g << R;
}