BZOJ 2295: [POJ Challenge]我爱你啊

由于是子序列,那么难度就在于读入

#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
char s[9]={'l','u','v','l','e','t','t','e','r'};
int main(){
	int T;
	scanf("%d",&T);
	char c=getchar();
	while (T--){
		int ID=0,ans=0;
		char c='-';
		while (c!='
'){
			c=getchar();
			if (c==s[ID]) ID++;
			if (ID==9) ans++,ID=0;
		}
		printf("%d
",ans);
	}
	return 0;
}

  

原文地址:https://www.cnblogs.com/silenty/p/9806734.html