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 ...
随机推荐
- spring in action 学习笔记二:aop的理解
一: aop的思想的来在哪里? 一个系统一般情况下由多个组件组成,而每一个组件除了干自己的本职工作以外,有时还会干一些杂活(如:日志(logging).事务管理(transaction manager ...
- oracle的隐式游标
游标的概念: 游标是SQL的一个内存工作区,由系统或用户以变量的形式定义.游标的作用就是用于临时存储从数据库中提取的数据块.在某些情况下,需要把数据从存放在磁盘的表中调到计算机内存中进行处理, ...
- 身为多年的ubuntu用户。。。
在这之前 说是多年也没有多年,事实上也就两年.. 不得不说一句,终于承受不住不稳定之重了... 个人觉得开始还是从centos开始比较好,比如说现在的我.. 之前看过的不知道在哪里的文章,谈论的是ub ...
- 几个简单的VBS脚本程序以及其JS实现
1 语音发声脚本,调用sapi.spvoice读英语hh 保存为say.vbs,点击打开就可以念诗: set objTTS = CreateObject("sapi.spvoice&quo ...
- (转)巴氏(bash)威佐夫(Wythoff)尼姆(Nim)博弈之模板
感谢:巴氏(bash)威佐夫(Wythoff)尼姆(Nim)博弈之模板 转自:http://colorfulshark.cn/wordpress/巴氏(bash)威佐夫(wythoff)尼姆(nim) ...
- HDU3068 最长回文
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission( ...
- 汕头市队赛 SRM10 T3 数学上来先打表
数学上来先打表 SRM 10 描述 给出 n个点(不同点之间有区别),求出满足下列条件的连边(双向边)方案:1.每条边连接两个不同的点,每两个点之间至多有一条边2.不存在三个点a,b,c使三个点间两两 ...
- jQuery遍历文档(重要)
什么是遍历? jQuery 遍历,意为"移动",用于根据其相对于其他元素的关系来"查找"(或选取)HTML 元素.以某项选择开始,并沿着这个选择移动,直到抵达您 ...
- python urllib2 常见请求方式
GET 添加headers头import urllib2 request = urllib2.Request(uri) request.add_header('User-Agent', 'fake-c ...
- python grequests和requests比较
#!/usr/bin/env python # encoding: utf-8 import grequests import requests import timeit import time d ...