|
|
back to boardWhy my program wrong in 4 test? give some tests!!! help plz (s menya pivo) var s:string; m:array[-50000..50000]of char; i,min,max,u:longint; begin readln(s); u:=0;min:=90001;max:=-90001; for i:=1 to length(s) do begin if s[i]='<' then dec(u); if u<1 then u:=1; if s[i]='>' then inc(u); if (s[i]<>'>')and(s[i]<>'<') then begin m[u]:=s[i]; if min>u then min:=u; if max<u then max:=u; inc(u); end; end; for i:=min to max do write(m[i]); end. Re: Why my program wrong in 4 test? give some tests!!! help plz (s menya pivo) Posted by it4.kp 7 Jun 2005 04:36 The length of the screen is 80 symbols! man give test plz. With my mistake! man give test plz. With my mistake! Re: Why my program wrong in 4 test? give some tests!!! help plz (s menya pivo) 1) Use a line long 80 2) Read out symbols Re: man give test plz. With my mistake! Posted by it4.kp 8 Jun 2005 05:12 Here is a piece of code: ........................................... s, res: string; p, i: integer; readln(s); res:= ''; for i:=1 to 80 do res:= res+' '; p:= 1; for i:=1 to length(s) do begin if s[i]='<' then begin dec(p); if p<1 then p:=1; end else if s[i]='>' then begin inc(p); if p>80 then p:=1; end else begin res[p]:= s[i]; inc(p); if p>80 then p:=1; end; end; write(res); ............................................... Something like that will give U AC. Re: man give test plz. With my mistake! I'm not sure, but I think it is because signs are "(:;-!?.,)" Re: Why my program wrong in 4 test? give some tests!!! help plz (s menya pivo) Posted by YuYu8 4 Aug 2018 10:08 In my case, the problem was that after writing char out I didn't wrap the cursor back to the beginning. |
|
|