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

I working hard in this program but i fet allvais CE? please help me. thencks
Posted by I am david. Tabo. 16 May 2002 16:05
var
  m : array [1..10000] of char;
  ch : char;
  lk , rk : integer;
  kin : boolean;
  tot ,step: integer;
procedure wrong;
begin
  writeln('NO');
  halt;
end;
begin
  tot := 0;
  repeat
    read(ch);
    inc(tot);
    m[tot] := ch;
  until ch = #26;
  step := 0;
  lk := 0;
  rk := 0;
  while step < tot do begin
    inc(step);
    if (m[step]='(') then begin
      if m[step+1] = '*' then begin
        step := step + 2;
        repeat
          inc(step);
          if step > tot then wrong;
        until (m[step]=')') and (m[step-1]='*');
        continue;
      end else inc(lk);
    end;
    if (m[step]=')') then inc(rk);
    if lk < rk then wrong;
    if (lk > rk) and not (m[step] in ['0'..'9','+','-
','*','/','=','(',')',#10,#13]) then wrong;
  end;
  if lk <> rk then wrong;
  writeln('YES');
end.

Re: I working hard in this program but i fet allvais CE? please help me. thencks
Posted by Илья Гофман (Ilya Gofman) 18 Nov 2002 14:35
I'm having the same problem. Maybe, it's really better to readln and
writeln?