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可以被认为是一个多维度的 ...
随机推荐
- 解决比较Oracle中CLOB字段问题
解决比较Oracle中CLOB字段问题 Oracle中CLOB和BLOB字段虽说在开发中满足了存放超大内容的要求,但是在一些简单使用中确频频带来麻烦.CLOB中存放的是指针,并不能直接取到实际值. ...
- ASP.NET文件组成(转载于Owen的BLOG)
一.扩展名: .aspx:窗体文件,为前台程序. .cs文件:类文件,主要为后台数据处理,供所有的.aspx文件的后台应用. .asmx文件:用于创建从其他应用程序使用的web服务的类. .css文件 ...
- spring 配置文件XSD地址
这边部署不能访问外网,所以sping配置文件里的XSD地址要改一下象 http://www.springframework.org/schema/beans/spring-beans-2.0.xsd ...
- POJ2367 Genealogical tree (拓扑排序)
裸拓扑排序. 拓扑排序 用一个队列实现,先把入度为0的点放入队列.然后考虑不断在图中删除队列中的点,每次删除一个点会产生一些新的入度为0的点.把这些点插入队列. 注意:有向无环图 g[] : g[i] ...
- 传智播客 Html基础知识学习笔记2
一.<select>标签 用来创建类似于WinForm中的ComboBox(下拉列表)或者LisBox 如果size大于1就是LisBox,否则就是ComboBox; <select ...
- javascript 中 "!function(){}() " 是什么意思?
叹号后面跟函数!function和加号后面跟函数+function都是跟(function(){})();这个函数是一个意思,都是告诉浏览器自动运行这个匿名函数的,因为!+()这些符号的运算符是最高的 ...
- CSS3实现三角形
很多时候我们用到三角形这个效果: 我们可以用CSS3实现这个效果,怎去做呢?先阐述一下原理,我们定义一个空的div,设置这个div宽高为0,给这个div加上一个100px边框(这里是方便观察),得到的 ...
- 自己实现一个SQL解析引擎
自己实现一个SQL解析引擎 功能:将用户输入的SQL语句序列转换为一个可运行的操作序列,并返回查询的结果集. SQL的解析引擎包含查询编译与查询优化和查询的执行,主要包含3个步骤: 查询分析: 制定逻 ...
- 杭电 HDU ACM Milk
Milk Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submi ...
- Caused by: java.lang.ClassNotFoundException: javassist.ClassPool
1.错误原因 usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ] { -help ...