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 1410. Crack

WA#5 Could not find mistake with my code
Posted by Nguyen Khac Tung 27 Mar 2012 19:57
Var     ch:Char;
        S:Array[-1..200000] of Longint;
        tmp:String;
        n,i,j,p,q,k,maxx:Longint;
Function max(x,y:Longint):Longint;
Begin
        If x>y then max:=x else max:=y;
End;

Begin
        tmp:='';
        s[0]:=0;
        While not eof do
         Begin
          Read(ch);
          If ((ch in ['a'..'z']) or (ch in ['A'..'Z'])) then tmp:=tmp+ch
          Else If length(tmp)>0 then
           Begin
            inc(n);
            p:=length(tmp);

            If (n<3) then s[n]:=p
            Else s[n]:=max(s[n-2],s[n-3])+p;

            If s[n]>maxx then maxx:=s[n];

            tmp:='';

           End;
         End;

        If n=0 then Writeln(length(tmp)) Else
        Writeln(maxx);
End.

Please help. Tks
Re: WA#5 Could not find mistake with my code
Posted by nobik 19 Jun 2012 00:35
HI!!! In 5  test ENTER))) Try to paste '$' between two lines))) Good day)))

Edited by author 19.06.2012 00:36
Re: WA#5 Could not find mistake with my code
Posted by pswgoo 6 Feb 2013 20:53
Thanks a lot,I got AC after looking your hint!