题意:看一个字符串中是否包含顺序的 w y h ,字符之间可以有其他字符,并且如果有多个连续的vv,则可以看做一个w
比较水,直接看代码
1 #include<cstdio> 2 #include<iostream> 3 #include<algorithm> 4 #include<cstring> 5 #include<cmath> 6 #include<queue> 7 #include<map> 8 using namespace std; 9 #define MOD 1000000007 10 const int INF=0x3f3f3f3f; 11 const double eps=1e-5; 12 typedef long long ll; 13 #define cl(a) memset(a,0,sizeof(a)) 14 #define ts printf("***** "); 15 const int MAXN=1005; 16 int n,m,tt; 17 char s[3145729]; 18 char s1[4]={'w','y','h'}; 19 int main() 20 { 21 int i,j,k; 22 #ifndef ONLINE_JUDGE 23 freopen("1.in","r",stdin); 24 #endif 25 scanf("%d",&tt); 26 while(tt--) 27 { 28 scanf("%s",&s); 29 int len=strlen(s); 30 int tot=0; 31 for(i=0;i<len;i++) 32 { 33 if(s[i]==s[i+1]&&s[i]=='v') 34 { 35 s[i]='w'; 36 } 37 if(s[i]==s1[tot]) 38 { 39 tot++; 40 } 41 } 42 if(tot==3) 43 { 44 printf("Yes "); 45 } 46 else printf("No "); 47 } 48 }