|
|
вернуться в форумWhy wrong?????????????? Послано IT 12 мар 2016 20:21 var A:array[1..1000] of integer; i,s,n,b,r,m,j,k,d,q:integer; begin s:=0; r:=0; q:=0; read(n); for i:=1 to n do readln(A[i]); begin for i := 1 to n-1 do for j := 1 to n-i do if A[j] > A[j+1] then begin k := A[j]; A[j] := A[j+1]; A[j+1] := k end; end; for i:=1 to (n-1) do begin d:=i+q; if (A[d]=A[d+1]) then s:=s+1 else s:=0; if s=3 then begin r:=r+1; s:=0; q:=1+q; end; end; write(r); end. |
|
|