|
|
вернуться в форумtest#1!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Послано dk647 16 окт 2007 19:08 whywhywhywhy?????? i can't find any mistake!!! (my English is very bad,sorry) var i,j,n,hoh,ha,hb:longint; a:array[0..21]of longint; procedure hh(x,y:integer); begin if y=1 then inc(ha,a[x]) else inc(hb,a[x]); if x<=n then begin if x<n then hh(x+1,1) else if abs(ha-hb)<hoh then hoh:=abs(ha-hb); if x<n then hh(x+1,0) else if abs(ha-hb)<hoh then hoh:=abs(ha-hb); end; end; begin readln(n); hoh:=maxlongint; for i:=1 to n do read(a[i]); ha:=0; hb:=0; hh(1,1); ha:=0; hb:=0; hh(1,0); writeln(hoh); end. |
|
|