Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

0ms过了

Posted by 785815369 at 2010-07-31 14:51:54 on Problem 1936 and last updated at 2010-07-31 14:52:58
In Reply To:我的16ms啊,怎么搞成0ms 啊。我实在是想不到 Posted by:liushengbing at 2010-05-28 16:45:59
#include<iostream>
#include<cstring>
using namespace std;
int main ()
{
	char s[100002],sub[100002];
	while(scanf("%s%s",sub,s)!=EOF)
	{
		int l_s,l_sub;
		l_sub=strlen(sub);
		l_s=strlen(s);
		int pre=-1;
		int sum=0;
		for(int i=0;i<l_sub;i++)
			for(int j=pre+1;j<l_s;j++)
				if(sub[i]==s[j]){pre=j;sum++;break;}
		if(sum==l_sub)cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator