|
|
вернуться в форумwa#13(((( i can't understand what is wrong((( var k:array[1..3] of integer; t:array[1..3] of integer; kt:byte=0; c,i,n:integer; begin readln(n); if n<3 then begin readln(c); writeln(c); end else begin kt:=0; for i:=1 to 3 do t[i]:=0; for i:=1 to n do begin read(c); if kt<3 then begin if kt=0 then begin t[1]:=c; inc(kt); end else begin if (kt=1) and (t[1]<>c) then begin inc(kt); t[2]:=c; end; if (kt=2) and (t[1]<>c) and (t[2]<>c) then begin inc(kt); t[3]:=c; end; end; end; if c=t[1] then inc(k[1]); if c=t[2] then inc(k[2]); if c=t[3] then inc(k[3]); end; c:=1; n:=k[1]; for i:=2 to 3 do if k[i]>n then begin c:=i; n:=k[i]; end; writeln(t[c]); end; {if k[1]>n div 2 then writeln(t[1]); if k[2]>n div 2 then writeln(t[2]); if k[3]>n div 2 then writeln(t[3]); readln;} end. |
|
|