Pagini recente » Cod sursa (job #1699672) | Cod sursa (job #281347) | Cod sursa (job #2102682) | Cod sursa (job #1768469) | Cod sursa (job #1839641)
#include <iostream>
#include <fstream>
using namespace std;
#define mod 1999999973
ifstream f("lgput.in");
ofstream g("lgput.out");
int N , P;
int rez;
long long exp_log ( int n , int p )
{
if ( p == 0 ) return 1;
else if ( p == 1 ) return n;
else
{
if ( p % 2 == 0 ) return exp_log( (n*n)%mod , p/2 );
else return ( n * exp_log( (n*n)%mod , (p-1)/2 ) )%mod ;
}
}
int main()
{
f >> N >> P;
g << exp_log(N,P);
return 0;
}