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

不知怎么会TLE了,觉得没办法在精炼了么

Posted by guohailin at 2009-07-19 23:35:08 on Problem 1936
#include<iostream>

using namespace std;

int main()
{
	char s[100000],t[100000];
	while(scanf("%s %s",&s,&t))
	{
		int i,j,l_s,l_t,k=0,flag=0;
		l_s=strlen(s);
		l_t=strlen(t);
		for(i=0;i<l_s;i++)
		{
			for(j=k;j<l_t;j++)
				if(s[i]==t[j])
				{
					flag++;
					k=j;
					break;
				}
		}
		if(flag==l_s)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
	}
	return 0;

}
谁帮忙看看啊 

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