cf D. Alternating Current
http://codeforces.com/contest/344/problem/D
#include <cstdio>
#include <cstring>
#include <stack>
#include <algorithm>
using namespace std; char str[];
int main()
{
stack<char>q;
scanf("%s",str);
int k=strlen(str);
for(int i=; i<k; i++)
{
if(q.empty())
{
q.push(str[i]);
}
else if(str[i]==q.top())
{
q.pop();
}
else if(str[i]!=q.top())
{
q.push(str[i]);
}
}
if(!q.empty()) printf("No\n");
else printf("Yes\n");
return ;
}
cf D. Alternating Current的更多相关文章
- Codeforces Round #200 (Div. 1) B. Alternating Current 栈
B. Alternating Current Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/343 ...
- CodeForces - 344D Alternating Current (模拟题)
id=46667" style="color:blue; text-decoration:none">CodeForces - 344D id=46667" ...
- Codeforces Round #200 (Div. 2)D. Alternating Current (堆栈)
D. Alternating Current time limit per test 1 second memory limit per test 256 megabytes input standa ...
- Alternating Current
Codeforces Round #200 (Div. 1) B:http://codeforces.com/problemset/problem/343/B 题意:这一题看懂题意是关键,题目的意思就 ...
- CF 964C Alternating Sum
给定两正整数 $a, b$ .给定序列 $s_0, s_1, \dots, s_n,s_i$ 等于 $1$ 或 $-1$,并且已知 $s$ 是周期为 $k$ 的序列并且 $k\mid (n+1)$,输 ...
- Codeforces 344D Alternating Current 简单使用栈
Description Mad scientist Mike has just finished constructing a new device to search for extraterres ...
- [CodeForces 344D Alternating Current]栈
题意:两根导线绕在一起,问能不能拉成两条平行线,只能向两端拉不能绕 思路:从左至右,对+-号分别进行配对,遇到连续的两个“+”或连续的两个“-”即可消掉,最后如果全部能消掉则能拉成平行线.拿两根线绕一 ...
- 跟着xiaoxin巨巨做cf
cf 385 C. Bear and Prime Numbers 题目大意:有一个数列{xi},每次给出一个询问[l, r],即问 S(l ,r)是l和r之间的素数,f(p)表示数列{xi}中整除p的 ...
- HBase 数据模型(Data Model)
HBase Data Model--HBase 数据模型(翻译) 在HBase中,数据是存储在有行有列的表格中.这是与关系型数据库重复的术语,并不是有用的类比.相反,HBase可以被认为是一个多维度的 ...
随机推荐
- UltraEdit-32 恢复到初始默认配置
不小心把UltraEdit-32搞乱了,字体不管怎么设置,都回不去了..然后那些菜单也被弄得乱七糟八的....于是就想把这些设置都搞成默认的.重装UltraEdit-32.清理注册表.结果发现都没有用 ...
- HTTP methods 与 RESTful API
Note GET, primarily used to select resources. Other options for an API method include: POST, primari ...
- Linux企业级项目实践之网络爬虫(25)——管理源代码之SVN
软件项目开发中,一般会用到源代码管理工具SVN.版本控制是管理数据变更的一种技术.对于程序员来说,它已经成为不可或缺的工具,因为他们经常修改软件代码,产生部分的变更,然后第二天再取消所有的变更.想象有 ...
- bzoj 1192
http://www.lydsy.com/JudgeOnline/problem.php?id=1192 好像学过一个东西: [0..2^(N+1)-1]内的数都的都可以由2^0,2^1,...,2^ ...
- bzoj1148
题目:http://www.lydsy.com/JudgeOnline/problem.php?id=1148 很常见的排序贪心题...... 假设我们得到了一个最优序列,记s[n]=w[1]+w[2 ...
- UVA514 Rails
铁轨 PopPush城市有一座著名的火车站.这个国家到处都是丘陵.而这个火车站是建于上一个世纪.不幸的是,那时的资金有限.所以只能建立起一条路面铁轨.而且,这导致这个火车站在同一个时刻只能一个轨道投 ...
- DHTML【8】--CSS
在讲HTML时说过,有个Style标签是在CSS里用的,是的,在HTML中添加CSS样式必须要用到Style,在标签里单独定义标签属性时用的是Style属性.上一节我们也说过,先不用管那个Style标 ...
- Activity与Fragment之间的通信
由于Fragment的生命周期完全依赖宿主Activity,所以当我们在使用Fragment时难免出现Activity和Fragment间的传值通信操作. 1.Activity向Fragment,通过 ...
- cumber + selenium +java自动化测试
1.新建一个maven项目,pom文件为: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=&quo ...
- Appium 点击Android屏幕
用driver.tap(1, 10, 10, 800); 点击屏幕,经常提示:An unknown server-side error occurred while processing the co ...