| 
 | 
вернуться в форумhelp me! What's wrong with my program? 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 + 1;         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.         You need to change only one symbol :) Firstly, you might get "Compilation error" because of this line:     if (lk > rk) and not (m[step] in ['0'..'9','+','- ','*','/','=','(',')',#10,#13]) then wrong;, you better make it shorter. But the main thing is that your program outputs 'YES' for this test case: (*) But it's, obviously wrong. So, there's only one symbol you have to change to get AC (by the way, you can be sure you will:)
  Re: help me! What's wrong with my program? >step:=step+1--->step:=step+2  |  
  | 
|