HDU - 4730 We Love MOE Girls
2016-07-18 08:41
357 查看
题目大意:结尾有 desu 的替换为 nanodesu,没有的直接在末尾加上 nanodesu
解题思路:检测覆盖
解题思路:检测覆盖
#include<iostream> #include<cstdio> #include<string.h> #include<stdlib.h> #include<cmath> using namespace std; int cnt = 0; char str[1000]; char a[]="desu"; char b[]="nanodesu"; int main() { int T; scanf("%d", &T); while (T--) { memset(str, '\0', sizeof(str)); scanf("%s", str); int len = strlen(str); int tag = 1, j = 0; for (int i = len - 4; i < len; i++) { if (str[i] != a[j++]) tag = 0; } if(tag) { j = 0; for (int i = len - 4; j < 8;i++) str[i] = b[j++]; } else strcat(str,b); printf("Case #%d: %s\n", ++cnt, str); } return 0; }
相关文章推荐
- [leetcode] 342. Power of Four
- 如何合理定价,定价定天下,必须要学会这个哦!
- jQuery学习<五> — — 选择器(下)
- 杭电ACM 1048
- 错误票据
- Android调试命令小结
- CodeForces - 567B Berland National Library
- CSS 最小高度
- 编程之美 - 电话号码对应英语单词
- iOS开发中的事件处理(二)-事件传递,响应者链条
- 文章标题
- IntentService的使用
- 在Linux使用SFTP接收文件
- 静态代理、JDK动态代理、CGLIB动态代理、Spring实现AOP、IOC+AOP
- Javascript—String类型
- MVC架构杂谈
- BestCoder 2nd Anniversary
- Task Schedule
- [leetcode] 198. House Robber
- 纯IPv6环境App适配的坑