6491: Daydream
题目描述
Append one of the following at the end of T: dream, dreamer, erase and eraser.
Constraints
1≤|S|≤105
S consists of lowercase English letters.
输入
S
输出
样例输入
erasedream
样例输出
YES
提示
Append erase and dream at the end of T in this order, to obtain S=T.
题意很简单,就是判断S字符串是不是有那四个单词组成,orz很水的题,可是当时写的时候比较卡。
那么我们就从字符串后面判断,如果有匹配的就删去就好了(你说为什么不从前面?dreamer 和erase、eraser 。我怎么知道该删的是dreamer 还是 dream,说不定后面有个erase或者eraser呢)
删除的话用 string.erase(pos,nops);
当然用 substr(pos,nops)把前面的不删除串赋值给原串也可以
#include<bits/stdc++.h>
using namespace std; int main()
{
string word;
cin>>word;
string a = "dreamer";
string b = "dream";
string c = "eraser";
string d = "erase";
int flag = ;
while(flag)
{
flag = ;
int len = word.length();
if(len < )break; if((word.compare(len-,len,b)==) || (word.compare(len-,len,d)==))
{
word.erase(len-,len);
flag = ;
continue;
}
if((word.compare(len-,len,c)==))
{
word.erase(len-,len);
flag = ;
continue;
}
if((word.compare(len-,len,a)==))
{
word.erase(len-,len);
flag = ;
continue;
}
}
if(word.length() == )printf("YES\n");
else printf("NO\n");
}
6491: Daydream的更多相关文章
- DayDream, 移动VR 2.0里程碑: 概述(上篇)
VR设备, 断断续续使用了很多个; 尤其是最近半年,主要是PC VR方面项目. 以前对移动VR不感冒,这几天试用了一下DayDream, 眼前突然一亮, 就如同年初首次使用HTC Vive眼前一亮的感 ...
- 关于Daydream VR的最直白的介绍
虚拟现实(Virtual Reality),简称虚拟技术,也称虚拟环境,是利用电脑模拟产生一个三度空间的虚拟世界,提供用户关于视觉等感官的模拟,让用户如同身历其境一般,电脑可以立即进行复杂的运算,将精 ...
- Google Daydream 在中国的第一次演讲摘录
从 PC.手机到 VR/AR,计算机平台正在迁移,而在这个过程中,与用户使用体验息息相关的「人机交互方式」也将不可避免的发生变化.作为这几波浪潮的弄潮儿,Google 怎么看这种人机交互方式的演进? ...
- 基于Daydream technical preview GVR13开发Daydream,Cardboard的Android应用
本文用Unity的Daydream Preview GVR13版本开发同时兼容Daydream和Cardboard的Android应用,Android Studio版本为2.2.3. 下载最新Dayd ...
- Android - Daydream 互动屏保
Android Daydream 互动屏保 API19 API23 Create:2016-03-01 继承DreamService来实现一个自定义屏保 Dreams是当充电的设备空闲,或者插入底座时 ...
- hdu_2668 Daydream O(n)求最长不重复子串
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2668 Daydream Time Limit: 2000/1000 MS (Java/Others) ...
- Unity3d外包公司|UE4外包公司:谷歌首款Daydream VR设备上手
这款售价仅为79美元(约合人民币525元)的产品内含“够用”的手柄和一台头戴设备,只要你有一台支持月日,10月5日,dream平台的手机(未来将成为安卓平台的标配),就能体验VR的乐趣. 即使该产品最 ...
- How do I install Daydream on my phone?
Google's philosophy with their newest VR platform is simple. In order to offer the best possible exp ...
- Daydream Controller手柄数据的解析
参考: How I hacked Google Daydream controller How I hacked Google Daydream controller (Part IV) 反编译代码: ...
随机推荐
- mvn tomcat7:help的14个命令
D:\2018\code\XXX>mvn tomcat7:help [INFO] Scanning for projects... [INFO] [INFO] ----------------- ...
- 第八单元 正文处理命令及tar命令
使用cat命令进行文件的纵向合并 两种文件的纵向合并方法 归档文件和归档技术 归档的目的 什么是归档 tar命令的功能 tar命令的常用选项 使用tar命令创建.查看及抽取归档文件 使用tar命令 ...
- Let the Balloon Rise <map>的应用
Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the ...
- Friends number
问题 : Friends number 时间限制: 1 Sec 内存限制: 128 MB 题目描述 Paula and Tai are couple. There are many stories ...
- loadrunner出现报错operands of = have illegal types `pointer to char' and `int'
原始代码: void split(char * p,char * str){ /* 传入一个数组进行p和一个以什么进行分割的str,返回切片后的值 */ int i = 0, j = 0; char ...
- ajax请求数据时什么时候用GET,什么时候用POST
GET的目的就如同其名字一样是用于获取信息的.它旨在显示出页面上你要阅读的信息.浏览器会缓冲GET请求的执行结果,如果同样的GET请求再次发出,浏览器就会显示缓冲的结果而不是重新运行整个请求.重新请求 ...
- shiro 单点登录原理 实例
原创 2017年02月08日 17:39:55 4006 Shiro 1.2开始提供了Jasig CAS单点登录的支持,单点登录主要用于多系统集成,即在多个系统中,用户只需要到一个中央服务器登录一次即 ...
- 安装Mycat 曾经踩的那些坑
1. INFO | jvm | ----/--/-- --:--:-- | Caused by: io.mycat.config.util.ConfigException: schema TEST d ...
- 使用layer弹出Ueditor实现父子传值
Layear的代码: function tankuang() { layer.open({ type: 2, title: false ...
- 解决notepad++64位没有plugin manager的问题
安装了最新的notepad++版本发现没有插件管理器,很难受. 后来上官网发现了这样一句话 Note that the most of plugins (including Plugin Manage ...