|
|
back to boardI got TL.Can anybody help me? const inp=''; var f:text; a:array[1..9,1..99]of 0..1; b:array[1..9]of integer; c:array[1..99]of integer; n,m,l:shortint; procedure print; var e,max:shortint; begin for l:=1 to m do begin max:=0; for e:=1 to n do if a[l,e]=1 then max:=max+1; writeln(max); for e:=1 to n do if a[l,e]=1 then write(c[e],' '); writeln; end; halt; end; procedure found(i:shortint); var j:shortint; begin for j:=1 to m do if b[j]-c[i]>=0 then begin a[j,i]:=1;b[j]:=b[j]-c[i]; if i<>1 then found(i-1) else print; a[j,i]:=0;b[j]:=b[j]+c[i]; end; end; begin fillchar(a,sizeof(a),0); assign(f,inp);reset(f); readln(f,n,m); for l:=1 to n do readln(f,c[l]); for l:=1 to m do readln(f,b[l]); close(f); found(n); end. |
|
|