Pagini recente » Statistici Litean (Litean_Roxana) | Cod sursa (job #457250) | Cod sursa (job #1716066) | Istoria paginii runda/leitentw1 | Cod sursa (job #651292)
Cod sursa(job #651292)
#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;
*rex %=1999999973;
}
}
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;
}