Pagini recente » Cod sursa (job #1811204) | Cod sursa (job #2613830) | Cod sursa (job #37700) | Cod sursa (job #220706) | Cod sursa (job #1391288)
#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;
if(x>MOD) x%=MOD;
n/=2;
}
else
{
p*=x;
if(p>MOD) 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;
}