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 ...
随机推荐
- C++学习之指针的常见错误
C++学习之指针的常见错误 我们在编程的过程中,有时候在使用指针的时候,删除一个指针以后一定要将这个指针设置为空指针,这是因为删除这个指针只是删除这个指针指向的地址,这个指针还真是的存在程 ...
- Linux系统环境变量的四个配置文件的关系
Linux系统环境变量配置有四个文件分别是: /etc/environment,/etc/profile,/etc/bash.bashrc,~/.bashrc 各配置文件意义 /etc/environ ...
- codeforces 535D. Tavas and Malekas KMP
题目链接 又复习了一遍kmp....之前都忘光了 #include<bits/stdc++.h> using namespace std; #define pb(x) push_back( ...
- 关于CSS动画几点要注意的地方
关于CSS动画几点要注意的地方 js操作transition无效果 先看这个demo以及stackoverflow的问题 http://jsfiddle.net/ThinkingStiff/QNnnQ ...
- 谷歌日志库GLog 使用说明
1 引用头文件 加载库 #include <glog/include/logging.h> #pragma comment(lib,"libglog.lib") 2 初 ...
- 源码安装rsyslog
<pre name="code" class="html">下载下列软件 json-c-0.12-20140410.tar.gz---------- ...
- openstack windows 2008 img
1,制作镜像主机pre Env yum -y install qemu-img virt-install libvirt 2,配置bridge
- 滴滴司机:要不是Uber,我买奥迪的45万元不知何时赚回来呢!
你在专车里看风景,看风景的人在系统上看你.补贴装饰了你的出行,你装饰了平台的梦. 这是移动互联网时代城市人们每天出行的形象写照.受“份子钱”之苦的出租车司机既享受也抗议,一洗“黑车”之名的专职司机满城 ...
- Java图形化界面设计——中间容器(Jpanel)
1. 将组件添加到JFrame中 方式之一: frame.getContentPane().add(childComponent) 用getContentPane()方法获得JFrame的内容面板, ...
- java的控制流程
1.顺序结构顺序结构就是指按语句执行的先后顺序,或者说语句出现的先后顺序逐条执行程序语句.语句块,完全是按照程序平台的执行约定进行的,比如第一个 HelloWorld程序:public class H ...