Pagini recente » Cod sursa (job #2497585) | Cod sursa (job #1141253) | Cod sursa (job #1927314) | Cod sursa (job #688220) | Cod sursa (job #1409962)
program elmaj;
var nr,x,n,m,c,i,j:longint;
bufin,bufout:array[1..1 shl 17] of byte;
begin
assign(input,'elmaj.in'); reset(input);
assign(output,'elmaj.out'); rewrite(output);
settextbuf(input,bufin);
settextbuf(output,bufout);
readln(n);
m:=-1; c:=1;
for i:=1 to n do
begin
read(x);
if x=m then inc(c)
else
begin
dec(c);
if c=0 then
begin
m:=x;
c:=1;
end;
end;
end;
close(input);
reset(input);
readln(n);
nr:=0;
for i:=1 to n do
begin
read(x);
if x=m then inc(nr);
end;
writeln(m,' ',nr);
close(output);
end.