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

In what a mistake?
Posted by matkir_ssau 25 Dec 2005 14:47
type kir=array[1..10000] of char;
var
m:kir;
y,u,t,e,q,i,w:longint;
r,ch:char;
f2,f1:text;
begin

assign(f1,'input.txt');
reset(f1);
i:=0;
read(f1,r);
while r in ['a'..'z','A'..'Z','0'..'9'] do begin
inc(i);
m[i]:=r;
read(f1,r);
end;
close(f1);
q:=i;

w:=q div 2;
for i:=q-1 downto w do
  begin  u:=0;
  for e:=1 to q-i do
    begin
    if m[i-e]=m[i+e] then  inc(u)
    else  break;
    end;
   if (u>t) and (e=q-i) then begin t:=u;y:=i;end;
  end;

  if t<>0 then begin u:=y-t-1;
                     for i:=1 to u do m[q+i]:=m[u-i+1];
                     q:=q+u;
                     end
          else begin for i:=1 to q do
          m[q+i-1]:=m[q-i+1];
          q:=q*2-1;
          end;
i:=1;
assign(f2,'output.txt');
rewrite(f2);
while i<=q do begin
 write(f2,m[i]);
 inc(i);
 end;
 close(f2);
  end.


Re: In what a mistake?
Posted by AndreyIvanov19SSAu 2 Jan 2006 01:53
Не надо использовать :
assign(f2,'output.txt');
rewrite(f2); и тому подобное.
И потом мне кажется тест вида AAA не пройдет!!!.
Re: In what a mistake?
Posted by ACM.Tolstobrov_Anatoliy[Ivanovo SPU] 2 Jan 2006 02:08

And It seems to me is not necessary to write in Russian.