|
|
вернуться в форумWHAT IS WA#4 ADMINSTRATOR HELP PLEASE !!!!!!!!!!!! IT'S MY COD var a:array [1..20010] of char; i,j,k,n,w:integer; r:char; s:string; f:boolean; g:text; t:integer; procedure solve; label 1; var e:integer; begin f:=false; t:=0; for k:=1 to n+i do if (a[k]<>a[n+i-k+1]) then goto 1; f:=true; 1: end; {IMPORTANT PART} Begin assign(g,'input.txt'); reset(g); while not eof(g) do begin readln(g,s); n:=0; for i:=1 to length(s) do begin n:=n+1; a[n]:=s[i]; end; i:=0; repeat solve; if not(f) then begin i:=i+1; for j:=n+i downto n+1 do begin a[j]:=a[j-1]; end; a[n+1]:=a[i]; solve; end; until f; end; // close(g); for j:=1 to n+i do write(a[j]); readln;readln; end. REAL MADRID LUCK THE BEST CLUB WHAT IS WA#4 Me too!!! program Ural1354; var s:string; a,b,l:longint; begin readln(s); l:=length(s); a:=1; while a<l do begin if s[a]<>s[l] then begin s:=s+' '; for b:=length(s) downto l+2 do s[b]:=s[b-1]; inc(l); s[l]:=s[a]; end; inc(a);dec(l); end; writeln(s); end. Re: WHAT IS WA#4 Послано Wyand 24 апр 2010 17:21 You are to find a nonempty word S2 if the input is palindrome... Re: WHAT IS WA#4 Test#4 abaabaaba ans: abaabaaba //for WA4, because S2 must be not empty! abaabaabaaba //for AC Edited by author 25.11.2011 17:57 Re: WHAT IS WA#4 Послано Rudolf 25 ноя 2015 02:54 I have the same answer, but still get WA4. What the problem? Re: WHAT IS WA#4 That's not the answer my friend. This is correct: abaabaaba abaababaaba As you see, your solution add three characters. Mine add only two. Greetings! Re: WHAT IS WA#4 nope, you should print S1 S2, as you see in your answer there is not clearly S1 |
|
|