Pagini recente » Monitorul de evaluare | Diferente pentru utilizator/robertstreche intre reviziile 8 si 9 | Diferente pentru utilizator/cmd_sg intre reviziile 12 si 2 | Diferente pentru utilizator/raduiris94 intre reviziile 4 si 5 | Cod sursa (job #2650039)
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
const int mod = 1999999973;
int exp(int n, int p)
{
if (p == 0)
return 1;
else
{
if (p % 2 == 0)
return (exp(n, p / 2) * exp(n, p / 2));
else
return (n * exp(n, p / 2) * exp(n, p / 2));
}
}
int main(void)
{
int n, p;
fin >> n >> p;
fout<< exp(n, p) % mod;
return 0;
}