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 ...
随机推荐
- 3.3 JSP内置对象概述
1.request 1.1 request获取页面传来的参数,参数通过浏览器网址和后面添加?的方式传达. 传参:”show.jsp?id=001” 获取参数:request.getParameter( ...
- virtual abstract override new 几点学习
1.Vitual方法和普通方法区别为:继承其的子类可以用override/new在重载此方法,也可以不重载其方法,有方法体(可以写语句),override修饰则调用子类方法2.abstract类中抽象 ...
- etcd ui
https://github.com/henszey/etcd-browser docker build --build-arg http_proxy=http://109.105.4.17:3128 ...
- drupal 7.1 doc
https://www.drupal.org/docs/8/api/database-api/dynamic-queries/count-queries https://www.drupal.org/ ...
- JS中如何处理多个ajax并发请求?
js中的多并发处理. 通常 为了减少页面加载时间,先把核心内容显示处理,页面加载完成后再发送ajax请求获取其他数据 这时就可能产生多个ajax请求,为了用户体验,最好是发送并行请求,这就产生了并发问 ...
- 前端基础之Bootstrap
1. 页面加载完之后才执行的JS代码 1. DOM方式 window.onload = function(){} 2. jQuery方式 ...
- Largest Rectangle in a Histogram(附上几组测试数据)
Largest Rectangle in a Histogram http://acm.hdu.edu.cn/showproblem.php?pid=1506 Time Limit: 2000/100 ...
- 关于"undefined reference"错误
这个错误换句话说: 链接的时候找不到实现的文件(谨记从这个入手!). 可能导致的原因有: 1. 没有链接库文件,包括静态库或动态库. 2. 链接文件的顺序问题,先后依赖问题,把被依赖的放后面. 3. ...
- 【校招面试 之 C/C++】第26题 C++ 智能指针(二)之 share_ptr
1.综述 shared_ptr 是一个标准的共享所有权的智能指针, 允许多个指针指向同一个对象. 定义在 memory 文件中(非memory.h), 命名空间为 std. shared_ptr 是为 ...
- CentOS下zabbix监控mysql5.6版本主从
目录 CentOS下zabbix监控mysql5.6版本主从 1. Zabbix添加自定义监控流程 2. 具体步骤 1. 编写监控mysql主从脚本 2. mysql赋权 3. 查看脚本执行效果 4. ...