hdu 5007 Post Robot
来源:互联网 发布:常德第七元素网络 编辑:程序博客网 时间:2024/06/06 04:25
模拟,利用string类和str.substr(begin,len)比较简单的完成字符串的比较。
#include<cstdio>#include<string>#include<iostream>using namespace std;char ans[2][20]={"MAI MAI MAI!","SONY DAFA IS GOOD!"};string str;int main(){ while(cin>>str){ int len=str.length(); for(int i=0;i<len;i++){ string a=str.substr(i,4); if(a=="iPod"||a=="iPad") cout<<ans[0]<<endl; else if(a=="Sony") cout<<ans[1]<<endl; a=str.substr(i,5); if(a=="Apple") cout<<ans[0]<<endl; a=str.substr(i,6); if(a=="iPhone") cout<<ans[0]<<endl; } } return 0;}
0 0
- HDU - 5007 Post Robot
- hdu 5007 Post Robot
- hdu 5007 Post Robot
- hdu 5007 Post Robot
- hdu 5007 Post Robot
- hdu 5007 Post Robot 水题
- hdu 5007 Post Robot(水题)
- HDU 5007 Post Robot(字符串寻找)
- HDU-#5007 Post Robot(暴力)
- HDU 5007-Post Robot(字符串)
- HDU——5007 Post Robot
- 字符串水题 hdu 5007 Post Robot
- hdu 5007 Post Robot【模拟】水题
- HDU 5007 Post Robot(西安网络赛A题)
- HDOJ 5007 Post Robot
- 杭电5007Post Robot
- Post Robot
- hdu 5007 Post Robot 水题 2014 ACM/ICPC Asia Regional Xi'an Online
- c++ 光标移动定位
- 【Struts2】②关于Action
- 东软学习,strut2初级学习的部分截图和笔记(五)-各种转发类型的解析
- 获得程序apk全路径名,获取文件的md5值,向线性布局中添加View对象
- zoj 1008 暴力枚举求解dfs+优化
- hdu 5007 Post Robot
- SPServices介绍之四:实现查阅项的级联选择功能(联动功能)
- 使用eclipse调试python出现SyntaxError:Non-UTF-8 code解决办法
- js window 对象
- SpringMVC学习系列(4) 之 数据绑定-1
- UIButton如何正确调整imageView及titleLabel的位置
- 香港有限公司税务申报要求及程序是什么?
- Html5笔记
- YoxView - jQuery图片浏览特效