|
|
вернуться в форумTest 5. what's wrong?? please help!! Послано Kirik 22 фев 2012 16:58 program f; var x,m,i,amount,s,j,g,k:integer; a: array [1..10000] of integer; begin read (m); for i:=1 to m do read (a[i]); for i:=1 to m do begin for j:=1 to m-1 do for g:=1 to m-j do if a[i]>a[i+1] then begin k:=a[i]; a[i]:=a[i+1]; a[i+1]:=k; end; end; amount:=(m div 2) +1; for i:=1 to amount do s:=s+(a[i]div 2)+1; write (s); end. Re: Test 5. what's wrong?? please help!! Послано tmp 12 мар 2012 22:56 Incorrect sort algorithm. Variable 's' not initialized. |
|
|