program task_e; {$APPTYPE CONSOLE} uses SysUtils; var f:text; dp:array[0..100,0..100] of int64; ans:array[1..2000] of int64; t,x,y,a,b,i:integer; function dpf(n,k:integer):int64; var i,j,i1,j1:integer; dp:array[0..100,0..100] of int64; function fmax(a,b:integer):integer; begin if (a>=b) then fmax:=a else fmax:=b; end; begin for i:=0 to n do begin for j:=0 to k do begin if (i=0) then begin dp[i,j]:=0; continue; end; if (i>j)or((i=0)and(j=0)) then begin dp[i,j]:=0; continue; end; if (i=j) then begin dp[i,j]:=1; continue; end; dp[i,j]:=-1; end; end; for i:=0 to n do begin for j:=0 to k do write(dp[i,j],' '); writeln; end; readln; for i:=2 to n do begin for j:=1 to i-1 do begin for i1:=0 to j do begin for j1:=0 to i-1 do begin if (i1=0)and(j1=0) then continue; dp[j,i]:=fmax(dp[j,i],) end; end; end; end; end; begin assign(f,'input.dat'); reset(f); readln(f,t); for i:=1 to t do begin readln(f,x,y,a,b); ans[i]:=dpf(x,y); end; close(f); assign(f,'output.ans'); rewrite(f); for i:=1 to t do writeln(f,ans[i]); close(f); { TODO -oUser -cConsole Main : Insert code here } end.