这题为何就70

P1739 表达式括号匹配

@[焜煊辰逸](/space/show?uid=131342) ``` #include<iostream> using namespace std; char a[255]; int main(){ int n=0,s=0; do{ n++; cin>>a[n]; if(a[n]=='(') s++; if(a[n]==')') s--; if(s<0){cout<<"NO";return 0;}//考虑:“)(”,这时s最后为0,但是不合法 }while(a[n]!='@'); if(s==0)cout<<"YES"; else cout<<"NO"; } ```
by 密期望 @ 2019-01-13 21:58:19


@[密期望](/space/show?uid=81705) 谢谢
by 周宇鑫 @ 2019-01-14 09:29:45


优秀
by NOI_LHY @ 2019-01-18 15:52:49


|