Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
大牛们帮忙看看,为什么RE?在自己电脑上编译没问题……var i,j,l,t:longint; ch:char; c:array [1..255,1..255] of byte; x,y1,y2,z1,z2:string; procedure findz(y:string; var z:string); var i,j:longint; begin fillchar (c,sizeof(c),0); for i:=1 to length(x) do for j:=1 to length(y) do if x[i]=y[j] then c[i,j]:=c[i-1,j-1]+1 else if c[i-1,j]>c[i,j-1] then c[i,j]:=c[i-1,j] else c[i,j]:=c[i,j-1]; z:=''; i:=length(x); j:=length(y1); while (i>0) and (j>0) do if x[i]=y[j] then begin z:=z+x[i]; dec (i); dec (j); end else if c[i-1,j]>c[i,j-1] then dec (i) else dec (j); end; begin readln (t); for l:=1 to t do begin x:=''; y1:=''; y2:=''; read (ch); while ch<>' ' do begin x:=x+ch; read (ch); end; readln (y1); for i:=1 to length(y1) do y2:=y2+y1[length(y1)+1-i]; findz(y1,z1); findz(y2,z2); if (z1=y2) or (z2=y1) then writeln ('YES') else writeln ('NO'); end; end. Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator