hdu 5007
http://acm.hdu.edu.cn/showproblem.php?pid=5007
字符串处理
暴力
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <queue>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
#define RD(x) scanf("%d",&x)
#define RD2(x,y) scanf("%d%d",&x,&y)
#define clr0(x) memset(x,0,sizeof(x)) typedef long long LL;
char s[40000];
int n;
int main(){
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
//cout<<(8*1024*4);
char a[10] = "Apple",b[10] = "iPhone",c[10] = "iPod",d[10] = "iPad",e[10] = "Sony";
while(scanf("%s",s)!=EOF){
n = strlen(s);
for(int i = 0;i < n;){
if(s[i] == 'A' && i + 4 < n){
if(s[i+1] == 'p' && s[i+2] == 'p' && s[i+3] == 'l' && s[i + 4] == 'e'){
puts("MAI MAI MAI!");
i = i + 5;
}
else
++i;
}
else if(s[i] == 'S' && i + 3 < n){
if(s[i+1] == 'o' && s[i+2] == 'n' && s[i+3] == 'y'){
puts("SONY DAFA IS GOOD!");
i = i + 5;
}
else
++i;
}
else if(s[i] == 'i' && i+1 < n && s[i+1] == 'P'){
bool flag = false;
if(i+3 < n && s[i+3] == 'd')
if(s[i+2] == 'o' || s[i+2] == 'a'){
puts("MAI MAI MAI!");
i = i + 3;
flag = true;
}
if(i + 5 < n && s[i+2] == 'h' && s[i+3] == 'o' && s[i + 4] == 'n' && s[i+5] == 'e'){
puts("MAI MAI MAI!");
i = i + 4;
flag = true;
}
if(!flag)
++i;
}
else ++i;
}
}
return 0;
}
hdu 5007的更多相关文章
- HDU 5007 Post Robot KMP (ICPC西安赛区网络预选赛 1001)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5007 解题报告:输入一篇文章,从头开始,当遇到 “Apple”, “iPhone”, “iPod”, ...
- hdu 5007 水 弦
http://acm.hdu.edu.cn/showproblem.php?pid=5007 纯粹的联系String的substr 什么时候substr拦截比写短话 string te; int n; ...
- hdu - 5007 Post Robot (水题)
http://acm.hdu.edu.cn/showproblem.php?pid=5007 #include<iostream> #include<stdio.h> #inc ...
- 【HDU 5007】Post Robot
Description DT is a big fan of digital products. He writes posts about technological products almost ...
- 2014 ACM/ICPC Asia Regional Xi'an Online(HDU 5007 ~ HDU 5017)
题目链接 A题:(字符串查找,水题) 题意 :输入字符串,如果字符串中包含“ Apple”, “iPhone”, “iPod”, “iPad” 就输出 “MAI MAI MAI!”,如果出现 “Son ...
- HDU 5007 Post Robot
Post Robot Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total ...
- hdu 5007 水题 (2014西安网赛A题)
题意:出现Apple.iPod.iPhone.iPad时输出MAI MAI MAI!,出现Sony,输出SONY DAFA IS GOOD! Sample InputApple bananaiPad ...
- Spring-1-A Post Robot(HDU 5007)解题报告及测试数据
Post Robot Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K Problem Description ...
- HDU 5007 字符串匹配
http://acm.hust.edu.cn/vjudge/contest/122814#problem/A 匹配到字符串就输出,水题,主要是substr的运用 #include <iostre ...
随机推荐
- SJY摆棋子&&[Violet 3]天使玩偶
SJY摆棋子 https://www.lydsy.com/JudgeOnline/problem.php?id=2648 [Violet 3]天使玩偶 https://www.lydsy.com/Ju ...
- HttpURLConnection(二)
package com.cmy.urlcon; import java.io.BufferedReader; import java.io.InputStream; import java.io.In ...
- TZOJ 4813 机器翻译(模拟数组头和尾)
描述 小晨的电脑上安装了一个机器翻译软件,他经常用这个软件来翻译英语文章. 这个翻译软件的原理很简单,它只是从头到尾,依次将每个英文单词用对应的中文含义来替换.对于每个英文单词,软件会先在内存中查找这 ...
- C# .net MD5加密函数
using System.Web.Security; string password =FormsAuthentication.HashPasswordForStoringInConfigFile(t ...
- OC - 缓存 - NSCache - 介绍
- golang实现任务分发处理
package main import ( "flag" "fmt" "os" "log" "net/http ...
- Parallel.Foreach的基础知识
微软的并行运算平台(Microsoft’s Parallel Computing Platform (PCP))提供了这样一个工具,让软件开发人员可以有效的使用多核提供的性能. Visual Stud ...
- DB2频繁出现死锁,常用解决问题的命令
--DB2频繁出现死锁,常用解决问题的命令db2 get snapshot for locks on sampledb2 get db cfg for sampledb2 update db cfg ...
- ObjC.instancetype
1. instancetype http://nshipster.com/instancetype/ 2. Objc的扩展 http://clang.llvm.org/docs/LanguageExt ...
- 02 请求库之 selenium模块
selenium模块 一 介绍 selenium最初是一个自动化测试工具,而爬虫中使用它主要是为了解决requests无法直接执行JavaScript代码的问题 selenium本质是通过驱动 ...