uses crt; var n,d,j,m,vt,i:longint; a:array[1..1000000]of longint; begin clrscr; write(‘n=’);readln(n); for i:=1 to n do begin write(‘a[‘,i,’]=’);readln(a[i]); d:=0; for j:=1 to i do if a[i]=a[j] then inc(d); if d>m then begin m:=d; vt:=i; end; end; writeln(a[vt],’ ‘,m); readln end.
program xuathien;
uses crt;
var max,d,i,j,n,pt:integer;
A:array[1..100] of integer;
begin
clrscr;
write(‘Nhap so luong phan tu: ‘); readln(n);
writeln(‘NHAP TUNG PHAN TU CUA MANG’);
for i:=1 to n do
begin
write(‘A[‘,i,’]= ‘);
readln(A[i]);
end;
max:=1; pt:=A[1];
for i:=1 to n do
begin
d:=0;
for j:=i to n do
if A[j]=A[i] then inc(d);
if d>max then
begin
max:=d;
pt:=A[i];
end;
end;
write(pt,’ co so lan xuat hien ‘,max,’ la nhieu nhat’);
readln
end.
uses crt;
var n,d,j,m,vt,i:longint; a:array[1..1000000]of longint;
begin
clrscr;
write(‘n=’);readln(n);
for i:=1 to n do
begin
write(‘a[‘,i,’]=’);readln(a[i]);
d:=0;
for j:=1 to i do if a[i]=a[j] then inc(d);
if d>m then begin m:=d; vt:=i; end;
end;
writeln(a[vt],’ ‘,m);
readln
end.