Hust oj 1497 Death Knight Hero(字符串水题)
来源:互联网 发布:故宫淘宝是故宫开的吗 编辑:程序博客网 时间:2024/06/06 02:30
There once was a champion of WoW Arthasdkthe name he was bestowed He Death Gripped you to his side His Chains of Ice stopped your stride And Obliterates made you say "OWW!"
But one day our hero got puzzled ,His Death Grip totally fizzled In his darkest despair He could barely hear "OMG NOOB u Chains of Iced than u Death Gripped".
InputYou are given a recording of the abilities our hero used in his battles.
There are several test cases. For each test case:
The first line of input will contain a single integer n(1<=n<=100), the number of battles our hero played.
Then follow n lines each with a sequence of ki ((1<=ki <=1000) characters, each of which are either 'C', 'D' or 'O'. These denote the sequence of abilities used by our hero in the i-th battle. 'C' is Chains of Ice, 'D' is Death Gripand 'O' is Obliterate.
Output For each test case,Output the number of battles our hero won, assuming he won each battle where he didnot Chains of Ice immediately followed by Death Grip.Sample Input3
DCOOO
DODOCD
CODSample Output
2
最烦翻译题。。。输入n个字符串,问有几个字符串中不包含连着的CD
#include<cstdio>#include<cstring>#include<iostream>using namespace std;int n;const int Maxn = 1005;char str[Maxn];int main(){ while(~scanf("%d",&n)) { int temp = n; for(int i=0;i<n;i++) { scanf("%s",&str); int flag = 0; int len = strlen(str); for(int i=1;i<len;i++) { if(str[i] == 'D' && str[i-1] == 'C') { flag = 1; } } if(flag) temp--; } printf("%d\n",temp); }}
- Hust oj 1497 Death Knight Hero(字符串水题)
- Death Knight Hero解题报告
- BNU 225587 Death Knight Hero【水水签到记录代码】
- Hust oj 1388 Knight(BFS)
- Hust oj 2106 Genuine Messages(字符串)
- Hust oj 1177 Time Transform(字符串)
- Hust oj 1945 纸牌小游戏(模拟水题)
- Hust oj 1052 Darts(翻译题)
- Hust oj 1109 店长终极推荐(字符串)
- Hust oj 2084(大数)
- Hust oj 1184 早起一水(简单贪心)
- Hust oj 1341 Who will be punished(字符串异或)
- Hust oj 2038 联系网络(MST)
- Hust oj 2234 土豪银行(贪心)
- Hust oj 1143 泉水(dfs)
- Hust oj 2113 Count(Map)
- Hust oj 1305 多边形(数学)
- Hust oj 1677 一个函数(栈)
- 工作中遇到的Android内存优化问题(3)-leakcanary源码解析
- 理解JavaScript的原型属性
- 使用百度地图时遇到的一些坑
- LinkedList<E>源码学习笔记
- Android-day03-EditText
- Hust oj 1497 Death Knight Hero(字符串水题)
- word设置不显示回车和英文下面的红色波浪线
- spark 2.0.0 Structured Streaming Programming
- 360笔试2017
- 了解和使用keystone(四)创建普通用户
- (2016秋数据结构课后练习题总结)02-线性结构4 Pop Sequence (25分)
- Android-day03-ImageView
- 奇虎360 2017校招笔试题
- HDU2489-Minimal Ratio Tree