Pagini recente » Cod sursa (job #589817) | Cod sursa (job #1555529) | Cod sursa (job #1700934) | Cod sursa (job #1486447) | Cod sursa (job #3174366)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int PutereON(int A , int n)
{
int P = 1 ;
for(int i = 1 ; i <= n ; i ++)
P = P * A;
return P;
}
int PutereRec(long long int A ,long long int n)
{
if(n == 0)
return 1;
if(n % 2 == 1)
return A * PutereRec(A , n - 1);
int P = PutereRec(A , n / 2);
return P * P;
}
int Putere(int A , int n)
{
int P = 1;
for(int k = 1 ; k <= n ; k <<= 1)
{
if((n & k))
P *= A;
A = A * A;
}
return P;
}
int main()
{
long long int N, P;
fin >> N >> P;
fout << Putere(N,P) % 1999999973 << endl;
fin.close();
fout.close();
return 0;
}