Pagini recente » Cod sursa (job #304304) | Cod sursa (job #2896658) | Cod sursa (job #1401413) | Cod sursa (job #933742) | Cod sursa (job #1391291)
#include <cstdio>
#define ll long long
#define MOD 1999999973
using namespace std;
FILE*f=fopen("lgput.in","r");
FILE*g=fopen("lgput.out","w");
ll x,n,p=1;
int main()
{
fscanf(f,"%d%d",&x,&n);
//30 de puncte
while(n)
{
if((( x >> 1) << 1 ) == 1)
{
x*=x;
x%=MOD;
n/=2;
}
else
{
p*=x;
p%=MOD;
n--;
}
}
/*for(int i=0; (1 << i) <=n;i++)
{
if( ( (1<<i) & n ) > 0 )
p=(p*x)%MOD;
x=(x*x)%MOD;
}*/
fprintf(g,"%d\n",p);
return 0;
}