|
|
вернуться в форумwhy WA? HELP ME! here is my program; tell me what's wrong with it.plz. program khosrow; var c,i,j,h,n,sum,sub:integer; a,w:array[1..20]of integer; begin read(n); sum:=0; for i:=1 to n do begin readln(w[i]); sum:=sum+w[i]; end; c:=sum; for i:=1 to n do a[i]:=0; repeat i:=0; repeat inc(i); until a[i]=0; a[i]:=1; for j:=1 to i-1 do a[j]:=0; sub:=0; for h:=1 to n do if a[h]=1 then sub:=sub+w[h]; if c>abs(sum-(2*sub)) then c:=abs(sum-(2*sub)); until sub=sum; writeln(c); end. |
|
|