经早上测验,第三组输出数据中的最后一个空格后面确实有问题,已经请管理员修改。
Sorry.
我的源程序中tyvj通过,但是不知为什么输出的测试数据会有问题,请指教。
var
a:array[0..10001] of string;
b,c:array[0..10001] of boolean;
i,j,k,l,m,n,f:longint;
ch:char;
s,tmp,tmp2,tmp3,new:string;
begin
readln(n);
readln(tmp);
fillchar(b,sizeof(b),true);
for i:=1 to length(tmp) do
begin
a[i]:=tmp[i];
end;
readln(s);
for i:=1 to length(s) do
begin
fillchar(c,sizeof(c),true);
f:=0;
new:='';
tmp2:='';
tmp3:='';
if s[i]='-' then continue;
if b[i]=false then continue;
if (ord(s[i])>=48) and (ord(s[i])<=57) and (s[i]<>'0') then
begin
tmp2:=tmp2+s[i];
if (ord(s[i+1])>=48) and (ord(s[i+1])<=57) then
begin
tmp2:=tmp2+s[i+1];
b[i+1]:=false;
end;
val(tmp2,k);
write(a[k]);
end;
if s[i]='0' then
begin
write(' ');
for j:=i-1 downto 1 do
begin
if s[j]='0' then break;
new:=s[j]+new;
end;
for j:=1 to length(new) do
begin
if c[j]=false then continue;
if new[j]='-' then continue;
tmp2:='';
tmp2:=tmp2+new[j];
if (ord(new[j+1])>=48) and (ord(new[j+1])<=57) then begin tmp2:=tmp2+new[j+1]; c[j+1]:=false; end;
val(tmp2,k);
tmp3:=tmp3+a[k];
end;
for j:=1 to n do
if tmp3=a[j] then begin f:=1; break; end;
if f=0 then
begin
inc(n);
a[n]:=tmp3;
end;
end;
end;
end.