Pagini recente » Cod sursa (job #523864) | Cod sursa (job #2004422) | Cod sursa (job #2338563) | Cod sursa (job #1019368) | Cod sursa (job #638429)
Cod sursa(job #638429)
Program ciuperci;
var q,i: longint;
n,nv,c:int64;{int64}
f1,f2:text;
Function comb(n,k:longint): longint; {int64}
Begin
if (k=0) or (k=n) then comb:=1
else comb:=comb(n-1,k)+comb(n-1,k-1);
end;
Begin
assign(f1, 'ciuperci.in');
assign(f2, 'ciuperci.out');
reset(f1); rewrite(f2);
readln(f1, q);
for i:=1 to q do
Begin
readln(f1, n);
nv:=n; c:=1;
while nv>=c do
Begin
nv:=nv-c;
c:=c*2;
end;
writeln(f2, comb(c,nv) mod 666013);
end;
close(f1); close(f2);
end.