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 ...
随机推荐
- one by one 项目 part 4
出现异常”The last packet sent successfully to the server was 0 milliseconds ago.“的大部分原因是由于数据库回收了连接,而系统的缓 ...
- do{}while() ;异常语句
//while (true) //只要括号里面是true(正确的如:(1==1)),就会无限循环 //{ //} //do{}while() //不管while满足与否,首先先做一遍 //然后去看wh ...
- 本地管理表空间(LMT)与自动段空间管理(ASSM)概念
创建表空间时,extent management local 定义本地管理表空间(LMT),segment space management auto 定义自动段空间管理(ASSM). extent ...
- HttpClient 4 和 HttpClient 3 超时
HttpClient 4: 连接超时: httpclient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT,6000 ...
- padright padleft
在 C# 中可以对字符串使用 PadLeft 和 PadRight 进行轻松地补位. PadLeft(int totalWidth, char paddingChar) //在字符串左边用 paddi ...
- Windows phone 自定义控件(无外观控件)——ColorPicker
编码前 在上一篇博客中,写的是一个UserControl的子类,它具有固定的外观(虽然也可以通过样式来进行修改,但受到的限制很大).如果你想要使用这个控件的逻辑,但是希望在使用的时候可以更改控件的外观 ...
- day4:vcp考试
Q61. Which two statements are true regarding Virtual SAN Fault Domains? (Choose two.)A. They enable ...
- 初学Hadoop之图解MapReduce与WordCount示例分析
Hadoop的框架最核心的设计就是:HDFS和MapReduce.HDFS为海量的数据提供了存储,MapReduce则为海量的数据提供了计算. HDFS是Google File System(GFS) ...
- centos7下创建mysql5.6多实例
一.mysql安装目录说明mysql5.6以二进制安装包安装在/data/mysql56下数据目录为/data/mysql56/data下配置文件为/etc/my.cnf下 二.多实例目录说明/mys ...
- 基于TCP的套接字
tcp服务端 1 ss = socket() #创建服务器套接字 2 ss.bind() #把地址绑定到套接字 3 ss.listen() #监听链接 4 inf_loop: #服务器无限循环 5 c ...