Pagini recente » Cod sursa (job #1359201) | Cod sursa (job #1000330) | Cod sursa (job #2537954) | Cod sursa (job #2117264) | Cod sursa (job #2665735)
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int n, p;
void citire()
{
fin >> n >> p;
}
void exponentiere_rapida(int x, int putere)
{
int p = 1;
while(putere)
{
if(putere % 2 == 1)
p = ((p%1999999973) * (x%1999999973))%1999999973;
x = ((x%1999999973) * (x%1999999973))%1999999973;
putere /= 2;
}
fout << p;
}
int main()
{
citire();
exponentiere_rapida(n,p);
return 0;
}