Pagini recente » Borderou de evaluare (job #1684685) | Cod sursa (job #3290511) | Cod sursa (job #2459787) | Cod sursa (job #3293581) | Cod sursa (job #1006457)
#include <fstream>
using namespace std;
ifstream is("lgput.in");
ofstream os("lgput.out");
int ExponentiereRapida(int x,int n)
{
if ( n == 0 )
return 1;
if ( n == 1 )
return x;
if ( n % 2 == 0 )
return ExponentiereRapida( x*x, n/2 );
if ( n % 2 == 1 )
return ExponentiereRapida( x*x, (n-1)/2 );
}
int main()
{
long long r,n,p;
is >> n;
is >> p;
r = ExponentiereRapida(n,p)%1999999973 ;
os << r;
}