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 ...
随机推荐
- poj 2187 Beauty Contest(二维凸包旋转卡壳)
D - Beauty Contest Time Limit:3000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u ...
- md5 加解密
using JGDJWeb.Model; using System; using System.Collections.Generic; using System.IO; using System.L ...
- ssh xshell 连接在vim中无法用 ctrl+insert 复制黏贴
在用户目录编辑.vimrc文件不存在则创建,vi的三种模式:命令模式,插入模式,可视模式,鼠标可以启动于各种模式中,所以配置文件中的set mouse=a启动了所有模式,这样就屏蔽了鼠标右健功能,se ...
- 100行代码实现最简单的基于FFMPEG+SDL的视频播放器(SDL1.x)【转】
转自:http://blog.csdn.net/leixiaohua1020/article/details/8652605 版权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[-] ...
- 华为上机测试题(及格分数线-java)
PS:自己写的,自测试OK,供大家参考. /* 描述:10个学生考完期末考试评卷完成后,A老师需要划出及格线,要求如下:(1) 及格线是10的倍数:(2) 保证至少有60%的学生及格:(3) 如果所有 ...
- C++笔试题目大全(笔试宝典)(不断完善中)
1.new . delete . malloc . free 关系 delete 会调用对象的析构函数 , 和 new 对应 free 只会释放内存, new 调用构造函数. malloc 与 fre ...
- 1.Centos-Docker安装和使用
1.安装docker yum install -y epel-release yum install -y docker-io 如果需要安装最新的docker,最好将系统升级到最新版 yum inst ...
- bisect维护已排序的序列
#!/usr/bin/env python # -*- coding:utf-8 -*- # author:love_cat import bisect # 用来处理已经排序好的序列,升序 # 二分查 ...
- SQLSERVER2008以上版本的数据恢复
这哥们真不错... http://blog.csdn.net/dba_huangzj/article/details/8491327
- AJAX中的同步加载与异步加载
AJAX是四个单词的简写,其中Asynchronous即异步的意思,异步的链接可以同时发起多个,并且不会阻止JS代码执行.与之对应的概念是同步,同步的链接在同一时刻只会有一个,并且会阻止后续JS代码的 ...