HNUSTOJ-1437 无题
1437: 无题
时间限制: 1 Sec 内存限制: 128 MB
提交: 268 解决: 45
[提交][状态][讨论版]
题目描述
tc在玩一个很无聊的游戏:每一次电脑都会给一个长度不超过10^5的字符串,tc每次都从第一个字符开始,
如果找到两个相邻相一样的字符,就会把它们删除掉,然后再重新从第一个字符开始,直到不能找到这样的字符,
这样tc就得胜了。 你能帮助tc吗?
输入
多组数据,每组一行字符。
输出
输出最后的字符串,占一行。
样例输入
abccbad
样例输出
d
#include<iostream>
#include<cstring>
#include<cstdio>
#include<deque>
using namespace std;
const int N = + ; char ch[N];
char str[N]; int main(){
while(fgets(str, N, stdin) != NULL){
memset(ch, '\0', sizeof(ch));
int len = strlen(str), cur = ;
for(int i = ; i < len; i++){
if(isspace(str[i])) continue;
if( cur == || ch[cur] != str[i]) ch[++cur] = str[i];
else if(ch[cur] == str[i]) cur--;
}
ch[++cur] = '\0';
puts(ch + );
}
return ;
}
HNUSTOJ-1437 无题的更多相关文章
- ural 1437. Gasoline Station
1437. Gasoline Station Time limit: 1.0 secondMemory limit: 64 MB Once a gasoline meter broke at a fi ...
- 九度OJ 1437 To Fill or Not to Fill -- 贪心算法
题目地址:http://ac.jobdu.com/problem.php?pid=1437 题目描述: With highways available, driving a car from Hang ...
- 07-09 07:28:38.350: E/AndroidRuntime(1437): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.googleplay.ui.activity.MainActivity" on path: DexPathList[[zip file "/data/app/c
一运行,加载mainActivity就报错 布局文件乱写一通,然后急着运行,报莫名其妙的错误: 07-09 07:28:38.350: E/AndroidRuntime(1437): Caused b ...
- Luogu 1437 [HNOI2004]敲砖块 (动态规划)
Luogu 1437 [HNOI2004]敲砖块 (动态规划) Description 在一个凹槽中放置了 n 层砖块.最上面的一层有n块砖,从上到下每层依次减少一块砖.每块砖都有一个分值,敲掉这块砖 ...
- 51nod 1437 迈克步(单调栈)
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1437 题意: 思路: 单调栈题.求出以每个数为区间最大值的区间范围即可. ...
- HPU 1437: 王小二的求值问题
1437: 王小二的求值问题 时间限制: 1 Sec 内存限制: 128 MB提交: 141 解决: 31 统计 题目描述 题意超级简单,求一个序列的次大值. 输入 多组输入,每个测试实例占两行,包括 ...
- 九度oj 1437 To Fill or Not to Fill 2012年浙江大学计算机及软件工程研究生机试真题
题目1437:To Fill or Not to Fill 时间限制:1 秒 内存限制:128 兆 特殊判题:否 提交:1488 解决:345 题目描述: With highways availabl ...
- 51nod 1437
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1437 1437 迈克步 题目来源: CodeForces 基准时间限制: ...
- HDU 1871 无题
无题 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submiss ...
随机推荐
- lazarus 连接mysql5.7 (deepin linux)
在mysql下载站点下载驱动文件:libmysqlclient20_5.7.28-1debian9_amd64 64位 ,1.5M 安装后,lazarus IDE 就可以直接连MYSQL ...
- CSS布局之flexbox
参考链接: https://www.cnblogs.com/qingchunshiguang/p/8011103.html 练习代码 <!DOCTYPE html> <html la ...
- ASP.NET大文件断点上传
HTML部分 <%@PageLanguage="C#"AutoEventWireup="true"CodeBehind="index.aspx. ...
- C++STL中的unique函数
头文件:#include<iostream> 函数原型:iterator unique(iterator it_1,iterator it_2); 作用:元素去重,即”删除”序列中所有相邻 ...
- R 常用代码段
#用来根据不同的细胞来源重新画TSNE图cell_source <-colnames(immune_nobatch) cell_type <- strsplit(cell_source,s ...
- windows下开启远程连接Mysql
使用“Ctrl + R”组合键快速打开cmd窗口,并输入“cmd”命令,打开cmd窗口. 使用“mysql -uroot -proot”命令可以连接到本地的mysql服务. 使用“use mysq ...
- Windows Server 部署WEB API时内部错误
Windows Server 部署WEB API时,发生HTTP 错误 500.21 - Internal Server Error,如图所示: 错误原因:IIS注册Framework4.0 解决方法 ...
- sql数据库相关语句
易错点 Where需要放在from语句之后:where中不能出现聚合函数(就是能够将几行一列合并为一行一列的函数,比如max,min,avg,count()):但是可以出现其他,如比较符,getdat ...
- java中定义注解
创建 @Target({ElementType.Type}) @Retention(RetentionPolicy.RUNTIME) public @interface Fruit { String ...
- 《Effective Java》读书笔记 - 9.异常
Chapter 9 Exceptions Item 57: Use exceptions only for exceptional conditions 这条item的意思就是,千万不要用except ...