【题意】
一个长度为N(N<=30000)的字符串,每次可以从队尾或队首拿出一个字符加入到新字符串队尾,求字典序最小的新字符串
【输入】
第一行一个N
接下来N行每行一个大写字母
【输出】
字典序最小的新字符串
题目跟3617一样,区别是数据范围变大了……因为是贪心效率很高,所以没改就过了……
program poj3623;
var
n,i,j,k:longint;
ans,s1,s2:ansistring;
temp:char;
begin
readln(n);
s1:='';
for i:=1 to n do
begin
readln(temp);
s1:=s1+temp;
end;
s2:='';
for i:=1 to n do
s2:......
阅读全文