hiho #1082 : 然而沼跃鱼早就看穿了一切
来源:互联网 发布:opta数据中文 编辑:程序博客网 时间:2024/06/07 06:57
题目描述:
时间限制:1000ms
单点时限:1000ms
内存限制:256MB
fjxmlhx每天都在被沼跃鱼刷屏,因此他急切的找到了你希望你写一个程序屏蔽所有句子中的沼跃鱼(“marshtomp”,不区分大小写)。为了使句子不缺少成分,统一换成 “fjxmlhx” 。
输入
输入包括多行。
每行是一个字符串,长度不超过200。
一行的末尾与下一行的开头没有关系。
输出
输出包含多行,为输入按照描述中变换的结果。
The Marshtomp has seen it all before.marshTomp is beaten by fjxmlhx!AmarshtompB
The fjxmlhx has seen it all before.fjxmlhx is beaten by fjxmlhx!AfjxmlhxB
解题思路:
这道题本身不难,就是要注意一些细节:句子末尾与句子开头没有关系;判断过程中大小写无关,但是输出的时候大小写敏感。
#include <cstdio>#include <cctype>using namespace std; int main(){ //freopen("t.txt", "r", stdin); char t; int currentIndex = 0; char *target = "marshtomp", *replace = "fjxmlhx", currStr[9]; while(scanf("%c", &t) != EOF){ if(t == '\n' && currentIndex != 0){ for(int i = 0; i < currentIndex; i++) printf("%c", currStr[i]); currentIndex = 0; } if(t < 'A' || (t > 'Z' && t < 'a') || t > 'z') printf("%c", t); else if(tolower(t) == target[currentIndex]){ currStr[currentIndex] = t; currentIndex++; if(currentIndex == 9){ printf("%s", replace); currentIndex = 0; } } else{ if(currentIndex != 0){ for(int i = 0; i < currentIndex; i++) printf("%c", currStr[i]); currentIndex = 0; } printf("%c", t); } } return 0;}
0 0
- hiho 1082 : 然而沼跃鱼早就看穿了一切
- hiho #1082 : 然而沼跃鱼早就看穿了一切
- hiho#1082 然而沼跃鱼早就看穿了一切
- #1082 : 然而沼跃鱼早就看穿了一切
- #1082 : 然而沼跃鱼早就看穿了一切
- #1082 : 然而沼跃鱼早就看穿了一切
- #1082 : 然而沼跃鱼早就看穿了一切
- #1082 : 然而沼跃鱼早就看穿了一切
- #1082 : 然而沼跃鱼早就看穿了一切
- 然而沼跃鱼早就看穿了一切
- hihocoder1082 然而沼跃鱼早就看穿了一切
- hiho1082 : 然而沼跃鱼早就看穿了一切
- 然而沼跃鱼早就看穿了一切
- 然而沼跃鱼早就看穿了一切
- 然而沼跃鱼早就看穿了一切 hihoCoder1082
- HihoCoder#1082 : 然而沼跃鱼早就看穿了一切
- hihoCoder:#1082 然而沼跃鱼早就看穿了一切
- hihocoder编程练习:#1082 : 然而沼跃鱼早就看穿了一切
- android事件分发机制
- [51nod]1134 最长递增子序列
- 自定义控件-概述
- Android中获取系统通讯录联系人
- poj 1654 Area
- hiho #1082 : 然而沼跃鱼早就看穿了一切
- BZOJ 2761 不重复数字(水题)
- 001——jdk环境配置
- Longest Consecutive Sequence
- iOS提示框之 MBProgressHUD 与 SVProgressHUD
- 自定义控件-继承ViewGrroup
- poj 3494 Largest Submatrix of All 1’s 单调栈/DP迭代法
- # android studio使用遇到的问题
- 谈谈Js闭包的那些事儿