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 1354. Palindrome. Again Palindrome

WA 3
Posted by Ignat Zakrevsky 8 Nov 2007 18:43
Please give me test №3.
Re: WA 3
Posted by Kapitoshka 9 Nov 2007 12:59
3th test is
AbabaAab   AbabaAababA  !!!!!!

I Use this solution and got AC

var n,i,j,k,f,r:longint;
 s,s2:ansistring;
 el:char;

function prov(f,n:longint):boolean;
 var i,j:longint;
  begin
   prov:=true;
    i:=f+1;
    j:=n-1;
     while i<j do
      begin
       if s[i]<>s[j] then
        begin
         prov:=false;
         exit;
        end;
       i:=i+1;
       j:=j-1;
      end;
  end;

 begin
  readln(s);
  write(s);
  n:=length(s);
   if n=1 then
    begin
      write(s[1]);
      halt;
    end;
  el:=s[n];
  if prov(1,n) then r:=1;

  for f:=2 to (n-r) do
   if s[f]=el then
      if prov(f,n) then

     begin
      for i:=(f-1) downto 1 do write(s[i]);
      Halt;
     end;






         i:=n-1;
         s:=s+s[i];
         n:=n+1;
         write(s[n]);
         while not prov(1,n) do
            begin
              i:=i-1;
              s:=s+s[i];
              n:=n+1;
              write(s[n]);
            end;

         halt;



 end.

Edited by author 09.11.2007 13:00
Re: WA 3
Posted by Ignat Zakrevsky 9 Nov 2007 14:07
Respect!