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 1027. D++ Again

whi i dot CE.please help me?here is a my program!I WILL TELL YOU THENKS
Posted by I am david. Tabo. 16 May 2002 16:25
Var Text                : Array[1..10001] of Char;
     Long                : Integer;
     D1,D2               : Integer;
     Now                 : Integer;

 Procedure Init;
 Var S     : String;
     i     : Integer;
 Begin
   Long := 0;
   Repeat
     Readln(S);
     For i := 1 to Length(S) do
       If S[i]<>#0 then
         Text[Long+i] := S[i];
     Inc(Long,Length(S));
   Until S='';
 End;

 Procedure Main;
 Var i,j : Integer;
       P : Integer;
 Begin
   P := 0;
   Now := 0;
   Repeat
     Inc(P);
     If Text[P]+Text[P+1]='(*' then
       Begin
         Inc(D1);
         Now := 2;
         Inc(P);
         Continue;
       End;
     If Now=2 then
       If Text[P]+Text[P+1]='*)' then
         Begin
           Dec(D1);
           If D1=0 then
             Begin
               If D2<>0 then Now := 1
                        else Now := 0;
             End;
           Inc(P);
           Continue;
         End;
     If Now<2 then
       Begin
         If Text[P]='(' then
           Begin
             Inc(D2);
             Now := 1;
             Continue;
           End;
         If Text[P]=')' then
           Begin
             Dec(D2);
             If D2=0 then Now := 0;
             Continue;
           End;
       End;
       If Now=1 then
         If Not(Text[P] in ['(',')','0'..'9','+','-
 ','*','/','=']) then
           Begin
             Writeln('NO');
             Halt;
           End;
     If Now=0 then
       If Text[P]=')' then
         Begin
           Writeln('NO');
           Exit;
         End;
   Until P=Long;
   If (D1<>0) or (D2<>0) then
     Begin
       Writeln('NO');
       Exit;
     End;
   Writeln('YES');
 End;

 Begin
   Init;
   Main;
 End.
Re: whi i dot CE.please help me?here is a my program!I WILL TELL YOU THENKS
Posted by ECUST Multistar 17 May 2002 12:25
You can't use TEXT as a var
It is a reserve word in Pascal