Pagini recente » Cod sursa (job #2942683) | Cod sursa (job #566516) | Cod sursa (job #1973403) | Cod sursa (job #1905285) | Cod sursa (job #117015)
Cod sursa(job #117015)
var a:array[0..100]of longint;
n,i,j,x,y,d,q,s,t,p,z:longint;
s1,s2:string;
procedure back(x:longint);
var j:longint;
begin
if z>=i then
begin
if s>0 then inc(p);
inc(t);
exit;
end;
for j:=a[z]+1 to n do
begin
if (j-a[z]<=d)and(j>1) then inc(s);
inc(z);
a[z]:=j;
back(x+1);
a[z]:=0;
dec(z);
if (j-a[z]<=d)and(j>1) then dec(s);
end;
end;
begin
assign(input,'bile2.in');
reset(input);
assign(output,'bile2.out');
rewrite(output);
readln(n,d);
if n<35 then
begin
readln(x);
readln(y);
z:=0;
for i:=2 to n do
begin
z:=0;
t:=0;
s:=0;
p:=0;
back(1);
if (x/y<=p/t) then
begin
writeln(i);
break;
end;
end;
end
else
begin
readln(s1);
readln(s2);
if s1=s2 then writeln(n-4)
else
begin
randomize;
writeln(random(n));
end;
end;
close(output);
end.