|
|
вернуться в форумWhy wrong answer? Послано Олег 19 апр 2012 21:21 program demokratiya; const max=9999; var k,i,j,N:integer; p: array [1..max] of integer; x,sum:integer; begin readln(k); N:=0; if (k<=101) and (k>=1) then begin for i:=1 to k do begin readln(p[i]); if (p[i] mod 2 = 0) or (p[i]>9999) then exit; N:=N+p[i]; end; if N>9999 then exit; for i:=1 to k-1 do for j:=i downto 1 do begin if p[j]>p[j+1] then begin x:=p[j]; p[j]:=p[j+1]; p[j+1]:=x; end; end; k:=trunc(k/2)+1; for i:=1 to k do begin p[i]:=trunc(p[i]/2)+1; writeln(p[i],' '); sum:=sum+p[i]; end; writeln(sum,' '); end; end. |
|
|