不是VIP会员,不能显示答案

题目解答

题目:
const
SIZE = 100;
var
dict: array [1..SIZE] of string;
rank, ind: array [1..SIZE] of integer;
i, j, n, tmp: integer;

begin
readln(n);
for i := 1 to n do
begin
rank[i] := i;
ind[i] := i;
readln(dict[i]);
end;
for i := 1 to n - 1 do
for j := 1 to n - i do
if dict[ind[j]] > dict[ind[j + 1]] then
begin
tmp := ind[j];
ind[j] := ind[j + 1];
ind[j + 1] := tmp;
end;
for i := 1 to n do
rank[ind[i]] := i;
for i := 1 to n do
write(rank[i], ' ');
writeln;
end.

输入:
7
aaa
aba
bbb
aaa
aaa
ccc
aa
输出:2 5 6 3 4 7 1
考点:
分析:
解答:
评论:
老师: