|
|
back to boardWrong answer test(4) Help me+++++ give some test+++++ program de; var s:string; i,j,l,z,ost:integer; q:boolean; mas:array[1..20000] of char; begin readln(s); l:=length(s); for i:=1 to l do mas[i]:=s[i]; if l=1 then writeln(mas[i]) else if (l=2) and (mas[1]=mas[2]) then writeln(mas[1],'',mas[2]) else begin q:=true; for i:=1 to l div 2 do if mas[i]<>mas[l-i+1] then q:=false; if q then begin for i:=1 to l do write(mas[i]); end else begin for i:=l div 2 to l do begin q:=true; z:=0; ost:=0; while z+i<>l do begin inc(z); if mas[i-z+1]<>mas[i+z] then q:=false; end; if q then ost:=1; z:=0; if q<>true then begin q:=true; while z+i<>l do begin inc(z); if mas[i-z]<>mas[i+z] then q:=false; end; end; if q then begin for j:=1 to i do write(mas[j]); if i<>l then i:=i+ost; for j:=i-1 downto 1 do write(mas[j]); break; end; end; end; end; readln; end. Re: Wrong answer test(4) Help me+++++ give some test+++++ Da ti idiot, blia!! var s1,s2:array[1..10000] of char; i,j,k,n,g,h:integer; noans:boolean; ch : char; begin read(ch); while ch in ['a'..'z','A'..'Z','0'..'9'] do begin inc(i); s1[i]:=ch; read(ch); end; n:=i; if n=0 then writeln(' '); if n=1 then writeln(s1[1],s1[1]); if n>1 then begin for j:=2 to n do begin noans:=true; h:=n; if s1[j]=s1[n] then begin noans:=false; for k:=j to ((n-j) div 2)+j-1 do begin if s1[k]=s1[h] then h:=h-1 else begin noans:=true; break; end; end; end; if not noans then begin for i:=1 to n do write(s1[i]); for g:=(j-1) downto 1 do write(s1[g]); halt; end; end; end; end. Re: Wrong answer test(4) Help me+++++ give some test+++++ Posted by famas 12 Apr 2005 16:06 butcherFac you xitro viebannii 4to-li. Tebe cpokoino ne givetcia. Tebia B realnoi gizni 4asto obigaut. Po4emy B tebe stolko zlosti??????? First - write in English, second - be polite, OK? ;) (-) Good (+), But I respect myself, and I shall not be silent on the insult. I agree with you. Always defend yourself (-) |
|
|