题意
找出最后一张覆盖在点上的地毯编号
分析
先输入,再从后面找,这样会更快
var
n,i,j:longint;
a:array[0..20]of string;
b,l:array[0..20]of longint;
begin
readln(n);
for i:=1 to n do
begin
readln(a[i]);
l[i]:=length(a[i]);
b[i]:=i;
end;
for i:=1 to n-1 do
begin
for j:=i+1 to n do
begin
if (l[i]<l[j])or(l[i]=l[j])and(a[i]<a[j]) then
begin
a[0]:=a[i];a[i]:=a[j];a[j]:=a[0];
l[0]:=l[i];l[i]:=l[j];l[j]:=l[0];
b[0]:=b[i];b[i]:=b[j];b[j]:=b[0];
end;
end;
end;
writeln(b[1]);
write(a[1]);
end.