Pagini recente » Cod sursa (job #694972) | Cod sursa (job #1843954) | Cod sursa (job #1956279) | Cod sursa (job #2589609) | Cod sursa (job #2249287)
#include <stdio.h>
#include <stdlib.h>
int main(){
FILE *fin, *fout;
fin = fopen ( "lgput.in", "r" );
fout = fopen ( "lgput.out", "w" );
long long n, p, x;
fscanf( fin, "%lld%lld", &n, &p );
x = 1;
do{
x = x % 1999999973;
if ( p % 2 != 0 )
x = x * n;
n = ( n * n ) % 1999999973;
p /= 2;
x = x % 1999999973;
}while ( p > 0 );
fprintf( fout, "%lld", x );
fclose ( fin );
fclose ( fout );
return 0;
}