比赛 暑假培训六 评测结果 TAATTTTTTA
题目名称 统计数字 最终得分 30
用户昵称 zpl123 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-07-23 11:22:17
显示代码纯文本
program pcount;
var
n,m:longint;
a:array[1..10000]of longint;
b:array[1..10000,1..2]of longint;
procedure ini;
var
i:longint;
begin
assign(input,'pcount.in');
reset(input);
assign(output,'pcount.out');
rewrite(output);
readln(n);
for i:=1 to n do
 readln(a[i]);
close(input);
end;

procedure order;
var
temp,i,j:longint;
begin
for i:=1 to n do
 for j:=i+1 to n do
  if a[i]>a[j] then
   begin
   temp:=a[i];
   a[i]:=a[j];
   a[j]:=temp;
   end;{then}
end;{order}

procedure count;
var
k,i,j:longint;
begin
k:=a[1];
b[1,1]:=k;
b[1,2]:=1;
i:=2;j:=1;
repeat
 while a[i]=k do
  begin
  inc(b[j,2]);
  inc(i);
  end;{while}
 if i<n then
  begin
  k:=a[i];
  inc(j);
  b[j,1]:=k;
  b[j,2]:=1;
  inc(i);
  end;{then}
until i=n+1;
m:=j;
end;

procedure main;
begin
order;
count;
end;{main}

procedure print;
var
i:longint;
begin
for i:=1 to m do writeln(b[i,1],' ',b[i,2]);
close(output);
end;

begin
ini;
main;
print;
end.