the Zeros and Ones
来源:互联网 发布:阿里云搭建ftp 编辑:程序博客网 时间:2024/05/18 13:05
#include<iostream>#include<string>#include<stack>using namespace std;int main(){int n, x, ans = 0;string str;stack<int> st;cin >> n >> str;for(int i = 0; i < n; ++i){x = str[i] - '0';if(st.empty()) st.push(x);else if(st.top() != x) st.pop(), ans += 2;else st.push(x);}cout << n-ans <<endl;return 0;}
0 0
- the Zeros and Ones
- A. Case of the Zeros and Ones
- A. Case of the Zeros and Ones
- Case of the Zeros and Ones
- Case of the Zeros and Ones
- Case of the Zeros and Ones
- Ones and Zeros
- Zeros and Ones
- UVa10324 - Zeros and Ones
- 10324 - Zeros and Ones
- Zeros and Ones
- [leetcode]ones and zeros
- Zeros and Ones UVA
- CodeForces 556A Case of the Zeros and Ones
- CodeForces-556A Case of the Zeros and Ones
- codeforces 556A Case of the Zeros and Ones
- Codeforces 556A:Case of the Zeros and Ones
- coderforce A. Case of the Zeros and Ones
- Wildcard Matching
- Fake Numbers
- Android中将布局文件/View添加至窗口过程分析 ---- 从setContentView()谈起
- iphone"此证书是由未知颁发机构签名的"的解决办法
- 生成不了p12证书的缘故
- the Zeros and Ones
- 假如今天是我生命中的最后一天(转摘)
- respondsToSelector的相关使用
- android背景选择器selector用法汇总
- Android中measure过程、WRAP_CONTENT详解以及xml布局文件解析流程浅析(上)
- android之XmlResourceParser类使用实例
- 10001---分布式系统中的数据同步
- android解析xml文件的方式(其一)
- iOS中系统唯一标识ID