noi4_1_1754[字符串数组排序问题]
Posted love_saber
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了noi4_1_1754[字符串数组排序问题]相关的知识,希望对你有一定的参考价值。
没忽略空格竟AC
var way:string;
a,b:array[1..100000] of string;
n:longint;
function cl(a,b:string):boolean;
begin
if (way=‘inc‘)or(way=‘dec‘) then exit(a>b);
exit(lowercase(a)>lowercase(b))
end;
procedure scanf;
var i:longint;
begin
readln(way);
readln(n);
for i:=1 to n do
readln(a[i]);
end;
procedure sort;
var i,j:longint;
tmp:string;
begin
b:=a;
for i:=1 to n-1 do
for j:=i+1 to n do
if cl(b[i],b[j]) then
begin
tmp:=b[i];
b[i]:=b[j];
b[j]:=tmp;
end;
a:=b;
if (way=‘dec‘)or(way=‘ncdec‘) then
begin
for i:=1 to n do
a[i]:=b[n+1-i];
end;
end;
procedure printf;
var i:longint;
begin
for i:=1 to n do
writeln(a[i]);
end;
begin
scanf;
sort;
printf;
end.
以上是关于noi4_1_1754[字符串数组排序问题]的主要内容,如果未能解决你的问题,请参考以下文章