|
|
back to boardWhat's wrong?(test 2) Posted by vlad 13 Jun 2005 21:21 const ma=1000; type strin=array[1..ma] of char; zx=record a,x,y:integer; end; var a:strin; i,j,c,k:integer; max:zx; function check(i,j:integer):boolean; var asd,q:integer; label poz; begin asd:=j-i; for q:=i to i+((j-i) div 2) do begin if a[q]<>a[j-(q-i)] then begin check:=false; goto poz; end; end; check:=true; poz: end; begin {assign(Input,'input.txt'); assign(output,'output.txt'); reset(Input); rewrite(Output);} i:=0; while not eoln do begin inc(i); read(a[i]); end; k:=i; c:=i-j; for i:=k downto 2 do for j:=i downto 1 do begin if (check(j,i)) and ((i-j)>=max.a) then begin max.a:=i-j; max.x:=j; max.y:=i; end; end; for i:=max.x to max.y do write(a[i]); writeln; { close(Input); close(Output);} end. some wrong test 1 answer 1 123 answer 1 good luck!!!11 Re: some wrong test Thank you, u a very help me. I thought that for 123 1 is incorrect answer) |
|
|