Pagini recente » Cod sursa (job #631288) | Cod sursa (job #2240517) | Istoria paginii runda/summer_camp_3 | Cod sursa (job #278941) | Cod sursa (job #1454001)
#include <iostream>
#include <fstream>
#define modul 1999999973
using namespace std;
ifstream fin ("lgput.in");
ofstream fout ("lgput.out");
long int FastExp ( long int N , long int P )
{
unsigned long int i ;
long int bit , copie ;
copie = N ;
long int solutie = 1 ;
for ( i = 0 ; ( bit = 1 << i ) <= P ; ++i )
{
if ( bit & P )
solutie = (solutie * copie ) % modul ;
copie = ( copie * copie ) % modul ;
}
return solutie ;
}
int main ()
{
long int N , P;
fin>>N>>P;
long int exp = FastExp (N,P) ;
fout << exp;
return 0;
}