ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1297. Palindrome

What'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
Posted by krupko victior [furmanov] 13 Jun 2005 23:53
1
answer 1
123
answer 1
good luck!!!11
Re: some wrong test
Posted by shadows_s 8 Feb 2012 02:58
Thank you, u a very help me.
I thought that for 123 1 is incorrect answer)