|
|
вернуться в форумwhy i WA???I ignore Enter,is it right??? program ural1027; {$APPTYPE CONSOLE} var t:array[1..10000] of Char; n:Longint; procedure Init; begin n:=0; while not Eof do begin while not Eoln do begin Inc(n); Read(t[n]); end; Readln; { if n=8 then Exit; } end; end; function Check:Boolean; var i,left:Longint; com,kh:Boolean; begin Check:=False; i:=1;left:=0;com:=False;kh:=False; while i<=n do begin if com then begin if t[i]='*' then begin if i=n then Exit; if t[i+1]=')' then begin com:=False; Inc(i,2); Continue; end; end; Inc(i); Continue; end; if t[i]='(' then begin if i=n then Exit; if t[i+1]='*' then begin com:=True; Inc(i,2); Continue; end; Inc(left); Inc(i); Continue; end; if t[i]=')' then begin Dec(left); if left<0 then Exit; if left=0 then kh:=False; Inc(i); Continue; end; if kh and (Pos(t[i],'0123456789+-*/=')=0) then Exit; Inc(i); end; Check:=(not com) and (not kh); end; begin Init; if Check then Writeln('YES') else Writeln('NO'); { Readln; } e |
|
|