Pagini recente » Cod sursa (job #750728) | Cod sursa (job #1676891) | Cod sursa (job #848387) | Cod sursa (job #2376618) | Cod sursa (job #651290)
Cod sursa(job #651290)
#include "stdio.h"
unsigned int a,b,r;
FILE *f,*g;
void pow(unsigned int p,unsigned int x,unsigned int *rez)
{
if(p*2<=b)
{
pow(p*2,x*x,rez);
if(b>=p)
{
b-=p;
*rez*=x;
}
}
else
{
*rez = x;
b-=p;
}
}
int main()
{
f = fopen("lgput.in","r");
g = fopen("lgput.out","w");
fscanf(f,"%d%d",&a,&b);
pow(1,a,&r);
fprintf(g,"%d",r%1999999973);
fclose(f);
fclose(g);
return 0;
}