1个回答
展开全部
var a:array[1..30]of longint;
n,i,j,t:integer;
begin
read(n);
for i:=1 to n do read(a[i]);
for i:=1 to n-1 do
for j:=1 to n-i do
if a[j]>a[j+1] then begin t:=a[j]; a[j]:=a[j+1]; a[j+1]:=t end;
i:=1; j:=1;
while i<n do
begin
write(a[i],':');
while (i<n)and(a[i]=a[i+1]) do begin inc(i); inc(j) end;
writeln(j); inc(i); j:=1;
end;
if i=n then writeln(a[n],':1');
end.
n,i,j,t:integer;
begin
read(n);
for i:=1 to n do read(a[i]);
for i:=1 to n-1 do
for j:=1 to n-i do
if a[j]>a[j+1] then begin t:=a[j]; a[j]:=a[j+1]; a[j+1]:=t end;
i:=1; j:=1;
while i<n do
begin
write(a[i],':');
while (i<n)and(a[i]=a[i+1]) do begin inc(i); inc(j) end;
writeln(j); inc(i); j:=1;
end;
if i=n then writeln(a[n],':1');
end.
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询