UVa10340-All in All
思路:
刚开始看到以为是LCS的模版题直接套上模版就交了果断T,二次读题后发现因为是原串在加密串按照顺序出现过就行,所以暴力遍历对比一遍就找出来了。
代码:
#include <bits/stdc++.h>
using namespace std;
#define N 1000005
char s[N],s2[N];
int main()
{
while(~
scanf(
"%s %s",s,s2))
{
int l=
strlen(s),l2=
strlen(s2),i,j;
for(i=
0,j=
0; i<l&&j<l2; j++)
{
if(s[i]==s2[j])i++;
}
if(i==l)
printf(
"Yes\n");
else printf(
"No\n");
}
return 0;
}
转载请注明原文地址: https://www.6miu.com/read-69804.html