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!='\n'){
			c=getchar();
			if (c==s[ID]) ID++;
			if (ID==9) ans++,ID=0;
		}
		printf("%d\n",ans);
	}
	return 0;
}

  

posted @ 2018-10-17 20:07  ~Silent  阅读(175)  评论(0编辑  收藏  举报
Live2D