Pagini recente » Cod sursa (job #1824558) | Cod sursa (job #1889705) | Cod sursa (job #1345792) | Cod sursa (job #1732647) | Cod sursa (job #651289)
Cod sursa(job #651289)
#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);
printf("%d",r%1999999973);
fclose(f);
fclose(g);
return 0;
}