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 ...
随机推荐
- js中函数的使用方式及回调函数
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- HttpClient 超时时间
setSoTimeout(MilSec):连接超时时间.如果在连接过程中有数据传输,超时时间重新计算. setConnectTimeout(MilSec):获取连接超时时间.如果该参数没有设置,那么默 ...
- webservice jaxws header验证
@WebService @HandlerChain public class UserService { ... } package com.xx.ws.header; import org.w3c. ...
- Educational Codeforces Round 58
D. GCD Counting 题意: 给出n个点的树,每个点有一个权值,找出一条最长的路径使得路径上所有的点的gcd>1 题解: gcd>1的一定不会有很多.所以暴力搞一下就行,不需要点 ...
- [leetcode]415. Add Strings字符串相加
Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2 ...
- 【转】HttpHandler的认识与加深理解
原文:http://www.cnblogs.com/whtydn/archive/2009/10/19/1585778.html HttpHandler是HTTP请求的处理中心,真正地对客户端请求的服 ...
- WARNING [main] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [] milliseconds.
编译安装tomcat-native和tomcat-deamon以后,发现toomcat启动很慢,好久才有响应.以下日志供参考: 11-Sep-2017 12:19:28.102 INFO [main] ...
- 搭建Eureka集群
1.pom文件 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="htt ...
- linux信号处理总结
本文主要讲解常见信号的处理方式. Sighup:终端关闭时,发送给此会话的所有进程组.Setsid成功后不再属于该会话,收不到该消息. Sigterm: kill process_id时产生. Si ...
- 766A Mahmoud and Longest Uncommon Subsequence
A. Mahmoud and Longest Uncommon Subsequence time limit per test 2 seconds memory limit per test 256 ...