Pagini recente » Rating Gheorghiu Vlad (VladGheorghiu) | Cod sursa (job #2967775) | Cod sursa (job #1917428)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
#define cheie 1999999973
long long int n, p, a;
void Citire()
{
fin >> n >> p;
fin.close();
}
int putere(int n, int p)
{
long long int a = 1;
while(p > 0)
{
if(p % 2 == 0)
{
p/=2;
n=((n % cheie) * (n % cheie))%cheie;
}
a = ((a % cheie) * (n % cheie)) % cheie;
p--;
}
return a;
}
int main()
{
Citire();
fout << putere(n, p) % cheie << "\n";
return 0;
}