hdu 5284 wyh2000 and a string problem(没有算法,仅仅考思维,字符数组得开20万,不然太小了)
代码:
#include<cstdio>
#include<cstring>
using namespace std; char s[200000]; int main()
{
int t;
scanf("%d",&t);
while(t--)
{
scanf("%s",s);
int w=0,y=0,h=0;
int len=strlen(s);
for(int i=0; i<len; i++)
{
if(w==0&&s[i]=='w')
{
w=1;
continue;
}
if(w==0&&i>=1&&s[i]=='v'&&s[i-1]=='v')
{
w=1;
s[i]=s[i-1]='a';
continue;
}
if(w==1&&y==0&&s[i]=='y')
{
y=1;
continue;
}
if(w==1&&y==1&&h==0&&s[i]=='h')
{
h=1;
break;
}
}
if(w==1&&y==1&&h==1)
printf("Yes\n");
else
printf("No\n");
} return 0;
}
hdu 5284 wyh2000 and a string problem(没有算法,仅仅考思维,字符数组得开20万,不然太小了)的更多相关文章
- HDU 5284 wyh2000 and a string problem(字符串,水)
题意:比如给你一个串,要求判断wyh是不是它的子序列,那么你只需要找一个w,找一个y,再找一个h,使得w在y前面,y在h前面即可.有一天小学生拿着一个串问他“wyh是不是这个串的子序列?”.但是wyh ...
- bestcoder 48# wyh2000 and a string problem (水题)
wyh2000 and a string problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K ...
- String类的实现,内部采用字符数组实现
#include <iostream> using namespace std; class String{ public: String(const char *str = NULL); ...
- 将string str中的str转换成字符数组
#include <iostream> #include <map> #include <string.h> using namespace std; int ma ...
- Java中字符数组、String类、StringBuffer三者的相互转换
一.StringBuffer与String的相互转换 1.将StringBuffer转换成String StringBuffer类成员toString函数可将其转换成String类型. StringB ...
- java实验五——字符数组、String、StringBuffer的相互转化,StringBuffer的一些方法
package hello; import java.util.Scanner; public class 实验五 { public static void main(String[] args) { ...
- C++string,char* 字符数组,int类型之间的转换
string.int 常见类型之间相互转换 int & string 之间的转换 C++中更多的是使用流对象来实现类型转换 针对流对象 sstream实现 int,float 类型都可以实现 ...
- hdu String Problem(最小表示法入门题)
hdu 3374 String Problem 最小表示法 view code#include <iostream> #include <cstdio> #include &l ...
- HDU 3374 String Problem(KMP+最大/最小表示)
String Problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) T ...
随机推荐
- Android 的保活的两种解决方案
原文链接:http://blog.csdn.net/pan861190079/article/details/72773549 详细的阐述了 Android 的保活的两种解决方案 —— 由panhao ...
- table 实现 九宫格布局
九宫格布局 最近遇到一个题目,是实现一个九宫格布局的.实现的效果大概是下图这种这样子的: (鼠标悬浮的时候,九宫格的边框颜色是改变的.) 首先想到的是直接使用<table>进行布局,原因很 ...
- 基于CSOCKET的Client简单实例(转)
原文转自 http://blog.csdn.net/badagougou/article/details/78410382 第一步:创建一个基类为CSOCKET类的新类,Cclient,并在主对话框类 ...
- (二十二)函数fseek() 用法
fseek 函数名: fseek功 能: 重定位流上的文件指针用 法: int fseek(FILE *stream, long offset, int fromwhere);描 述: 函数设置文件指 ...
- java基础练习 12
public class Twelfth { /*海滩上有一堆桃子,五只猴子来分.第一只猴子把这堆桃子凭据分为五份,多了一个,这只猴子把多的一个扔入海中,拿走了一份.第二只猴子把剩下的桃子又平均分成五 ...
- 安装戴尔OMSA
设置变量versionum=`cat /etc/redhat-release | awk '{print $3}' | awk -F '.' '{print $1}'`versionname=`cat ...
- 6.安装和配置OpenStack图片服务组件
安装和配置图片服务组件 这里是安装在控制器上 安装和配置图片服务组件 yum install –y openstack-glance python-glanceclient 编辑/etc/glance ...
- Java HotSpot(TM) 64-Bit Server VM warning: Insufficient space for shared memory file: /tmp/hsperfdata_hadoop/44512
早上登录hbase shell,出现异常: [hadoop@node002 ~]$ hbase shell Java HotSpot(TM) 64-Bit Server VM warning: Ins ...
- Appium+python自动化18-brew、carthage和appium-doctor【转载】
前言 本篇安装brew.carthage,解决启动appium时的报错问题,另外安装appium-doctor检查appium的环境 1.brew 2.carthage 3.appium-doctor ...
- C# 查看本机安装的NET Framework 版本
https://docs.microsoft.com/zh-cn/dotnet/framework/migration-guide/how-to-determine-which-versions-ar ...