CROC-MBTU 2012, Elimination Round / 245E Mishap in Club (想法题)
2014-03-09 11:03
429 查看
http://codeforces.com/problemset/problem/245/E
画个函数图像你就知道代码怎么写了。
画个函数图像你就知道代码怎么写了。
/*30ms,0KB*/ #include<bits/stdc++.h> using namespace std; const int mx = 305; char s[mx]; int main() { gets(s); int cnt = 0, ans = 0; for (int i = 0; s[i]; ++i) { if (s[i] == '+') { ++cnt; ans = max(ans, cnt); } else { --cnt; if (cnt < 0) { cnt = 0; ++ans; } } } printf("%d\n", ans); return 0; }
相关文章推荐
- CROC-MBTU 2012, Elimination Round (ACM-ICPC) E. Mishap in Club
- CROC-MBTU 2012, Elimination Round / 245F Log Stream Analysis (日期处理&二分)
- CROC-MBTU 2012, Elimination Round / 245D Restoring Table (位运算)
- CF CROC-MBTU 2012, Final Round div 2
- 【CROC 2016 - Elimination RoundB】【贪心】Mischievous Mess Makers 全排列1到n交换k次最多逆序数
- CROC 2016 - Elimination Round (Rated Unofficial Edition) B. Mischievous Mess Makers 贪心
- CF CROC-MBTU 2012, Elimination Round (ACM-ICPC)
- CROC-MBTU 2012, Elimination Round (ACM-ICPC) H DP题目
- CROC-MBTU 2012, Final Round (Online version, Div. 2)总结
- 解题报告:CROC 2016 - Elimination Round F. Cowslip Collections (莫比乌斯反演)
- 【CROC 2016 - Elimination RoundC】【二分】Enduring Exodus 最小的人看守与羊距离
- CROC 2016 - Elimination Round (Rated Unofficial Edition) C. Enduring Exodus 二分
- (CROC 2016 - Elimination Round (Rated Unofficial Edition))B. Mischievous Mess Makers(贪心)
- Codeforces Bayan 2012-2013 Elimination Round / 241A Old Peykan (贪心)
- 【CROC 2016 - Elimination RoundD】【二分答案orSet】Robot Rapping Results Report 最早多条边出现可以完成唯一拓扑序
- CROC-MBTU 2012, Elimination Round (ACM-ICPC) D. Restoring Table
- CROC-MBTU 2012, Final Round (Online version, Div. 2)
- CROC-MBTU 2012, Elimination Round (ACM-ICPC) E YY题目
- CROC-MBTU 2012, Elimination Round (ACM-ICPC)
- CROC-MBTU 2012, Final Round (Online version, Div. 2) (同是坑......待填..............无视之)