BNU 225587 Death Knight Hero【水水签到记录代码】
来源:互联网 发布:linux的vim命令 编辑:程序博客网 时间:2024/06/05 15:17
链接:
http://www.bnuoj.com/bnuoj/problem_show.php?pid=25587
http://www.bnuoj.com/bnuoj/contest_show.php?cid=2321#problem/25864
C. Death Knight Hero
1000ms
1000ms
65536KB
64-bit integer IO format: %lld Java class name: Main
Font Size:
There once was a champion of WoW
Arthasdk the 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"
Input
You are given a recording of the abilities our hero used in his battles.
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 Grip and 'O' is Obliterate.
Output
Output the number of battles our hero won, assuming he won each battle where he did not Chains of Ice immediately followed by Death Grip.
Sample Input
3DCOOODODOCDCOD
Sample Output
2
code:
注意:he won each battle where he did not Chains of Ice immediatelyfollowed by Death Grip
是 C 后面马上出现 D 就输,而不是 C 跟在 D 后面。。。。
/**题意:给你一个数 N 下面给出 N 个字符串代表 Hero 每次战争使用的技能 如果这次赢,则这串字符中不会出现 “CD”连在一起的情况 问:N次战斗,能赢几场。。。 */#include<stdio.h>#include<string.h>const int maxn = 1000+10;int n;char str[maxn];int main(){while(scanf("%d", &n) != EOF){int ans = 0;while(n--){scanf("%s", str);int len = strlen(str);int flag = 1;for(int i = 0; i < len-1; i++){if(str[i] == 'C' && str[i+1] == 'D'){flag = 0; break;}} if(flag) ans++;}printf("%d\n", ans);}return 0;}
- BNU 225587 Death Knight Hero【水水签到记录代码】
- Hust oj 1497 Death Knight Hero(字符串水题)
- Death Knight Hero解题报告
- BNU 29364 Invading system【签到】
- BNU 26473 Aaah!【签到--->查找字符串】
- death
- HDU6075(签到水题)
- 签到,打卡领取积分,记录连续签到,获取签到排名。
- 签到功能代码
- 每天一段代码,签到
- poj2243-Knight Moves-水bfs
- BNU
- python 工作自动签到记录
- 日历签到demo 实现记录
- 使用Gson获取签到记录
- HDU6033(多校联合签到水题)
- BNU 26582Gregory the Grasshopper 搜索水题
- hero
- struts2拦截器和服务器端手工编码验证
- 从C# 堆栈与堆(托管堆)说起(收集+整理+我的思考)
- Java多线程计算某个范围内的质数
- QT中Model/View结构
- Android中用Git来抓取你感兴趣列表的提交log
- BNU 225587 Death Knight Hero【水水签到记录代码】
- 任务管理器看进程
- NServiceBus翻译之Hosting(一):The NServiceBus Host
- java 反射机制
- hdu4081 Qin Shi Huang's National Road System
- codeforces 197 2
- oracle 游标处理过程
- Android 两Activity之间动画效果(3)---------缩放,仿QQ头像点击放大
- Android保存Log信息到本地文件