2 条题解
-
0
#include<bits/stdc++.h> using namespace std; int main() { string s; cin>>s; int i; stack<int>cnt,maxn; int cnts=0; cnt.push(0); maxn.push(0); for(i=0;i<s.size();i++) { if(s[i]=='(') { cnt.push(0); maxn.push(0); } if(s[i]=='a') { cnt.top()++; } if(s[i]=='|') { maxn.top()=max(maxn.top(),cnt.top()); cnt.top()=0; } if(s[i]==')') { maxn.top()=max(maxn.top(),cnt.top()); cnt.pop(); cnt.top()+=maxn.top(); maxn.pop(); } } maxn.top()=max(maxn.top(),cnt.top()); if(maxn.top()==10)cout<<11; else cout<<maxn.top(); }
- 1
信息
- ID
- 2836
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 6
- 标签
- 递交数
- 88
- 已通过
- 29
- 上传者