hdu 5007 水 弦
http://acm.hdu.edu.cn/showproblem.php?pid=5007
纯粹的联系String的substr
什么时候substr拦截比写短话
string te;
int n;
te="Hellow";
cout << te.substr(3,5);
我试了下 打印出来的是low....
写的时候没去限制边界还是AC了
//#pragma comment(linker, "/STACK:102400000,102400000")
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <map>
#include <set>
#include <queue>
using namespace std; #define ls(rt) rt*2
#define rs(rt) rt*2+1
#define ll long long
#define ull unsigned long long
#define rep(i,s,e) for(int i=s;i<e;i++)
#define repe(i,s,e) for(int i=s;i<=e;i++)
#define CL(a,b) memset(a,b,sizeof(a))
#define IN(s) freopen(s,"r",stdin)
#define OUT(s) freopen(s,"w",stdout)
const ll ll_INF = ((ull)(-1))>>1;
const double EPS = 1e-8;
const double pi = acos(-1.0);
const int INF = 100000000; int main()
{
string s;
while(cin>> s )
{
int len=s.size();
for(int i=0;i<len;i++)
{
string s4=s.substr(i,4);
string s5=s.substr(i,5);
string s6=s.substr(i,6);
if(s4 == "iPod" || s4 == "iPad" || s5 == "Apple" || s6=="iPhone")
puts("MAI MAI MAI!");
if(s4 == "Sony")
puts("SONY DAFA IS GOOD!");
}
}
return 0;
}
版权声明:本文博主原创文章,博客,未经同意不得转载。
hdu 5007 水 弦的更多相关文章
- hdu 5007 水题 (2014西安网赛A题)
题意:出现Apple.iPod.iPhone.iPad时输出MAI MAI MAI!,出现Sony,输出SONY DAFA IS GOOD! Sample InputApple bananaiPad ...
- HDU-1042-N!(Java大法好 && HDU大数水题)
N! Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Subm ...
- hdu - 5007 Post Robot (水题)
http://acm.hdu.edu.cn/showproblem.php?pid=5007 #include<iostream> #include<stdio.h> #inc ...
- HDU 5007 Post Robot KMP (ICPC西安赛区网络预选赛 1001)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5007 解题报告:输入一篇文章,从头开始,当遇到 “Apple”, “iPhone”, “iPod”, ...
- hdu 4464 水
http://acm.hdu.edu.cn/showproblem.php?pid=4464 现场赛总会有水题,这就是最水的一道,预计也就是能当高校的上机题,保研用,呵呵~~~ #include &l ...
- hdu 5007
http://acm.hdu.edu.cn/showproblem.php?pid=5007 字符串处理 暴力 #include <cstdio> #include <cstdlib ...
- HDU 5391 水题。
E - 5 Time Limit:1500MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit Statu ...
- 2014 ACM/ICPC Asia Regional Xi'an Online(HDU 5007 ~ HDU 5017)
题目链接 A题:(字符串查找,水题) 题意 :输入字符串,如果字符串中包含“ Apple”, “iPhone”, “iPod”, “iPad” 就输出 “MAI MAI MAI!”,如果出现 “Son ...
- hdu 1544 水题
水题 /* * Author : ben */ #include <cstdio> #include <cstdlib> #include <cstring> #i ...
随机推荐
- nginx args
$args $content_length $content_type $document_root $document_uri $host $http_user_agent $http_cookie ...
- ExpandableListView 箭头样式
ExpandableListVivew是ListView的子类,它在普通ListView的基础上进行了扩展,它把应用中的列表项分为几组,每组里 又可包含多个列表项.ExpandableListVive ...
- 如何实现win7和VirtualBox中Ubuntu系统共享文件夹
设备: 1.win7 旗舰版 2.VirtualBox虚拟机 3.Ubuntu12.04 以前在VM虚拟机中可以直接进行复制就可以将win7系统的文件复制到虚拟机中,然后现在安装了Virt ...
- windows server system32下常见快捷指令
win+R 命令行窗口 cmd dos命令窗口 mstsc 远程登录输入窗口 calc 快速打卡计算器 control 打开控制面板 eve ...
- Qt中如果通过QStyle自定义能够跨平台的界面控件
我们经常会碰到需要定制界面控件的要求.如果只是在一个平台上,比如说你的控件只需要在Windows上显示,那很好办,Hard code 你的look and feel就可以了.但是如果界面需要在不同平台 ...
- 64位WINDOWS系统环境下应用软件开发的兼容性问题(CPU 注册表 目录)
应用软件开发的64 位WINDOWS 系统环境兼容性 1. 64 位CPU 硬件 目前的64位CPU分为两类:x64和IA64.x64的全称是x86-64,从名字上也可以看出来它和 x86是兼容的,原 ...
- ubuntu安装XHProf
1. 安装XHProf wget http://pecl.php.net/get/xhprof-0.9.2.tgz tar zxf xhprof-0.9.2.tgz cd xhprof-0.9.2 s ...
- iOS 按钮倒计时功能
iOS 按钮倒计时功能, 建议把按钮换成label,这样会避免读秒时闪烁 __block ; __block UIButton *verifybutton = _GetverificationBtn; ...
- shell编程之文本与日志过滤
1:grep命令: grep -v "char" file_name 匹配不包括"char"的文本 grep -n -w "char" ...
- httpunit使用演示样例
import java.io.IOException; import java.net.MalformedURLException; import org.xml.sax.SAXException; ...