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

一个细节

Posted by TangMing at 2009-05-13 16:19:20 on Problem 1936
 if you can remove characters from t such that the concatenation of the remaining characters is 
表示删除后面的一些元素后可以找到前面的字符串则还是Yes
#include<iostream>
#include<string>
#include<fstream>
using namespace std;

int main(int argc, char* argv[])
{   
	string a,b;
	//fstream cin("aaa.txt");
	while(cin>>a>>b)
	{ 
	 int le=a.length();
	 int count=0,i=0,j=0;
	 if(a.length()>b.length()){printf("No\n");continue;}
	 for(i=0;j!=b.length()&&i<a.length();)
	 {
		 if(a[i]==b[j]){i++;j++;count++;}
		 else {j++;}
	 }
     if(count==a.length())printf("Yes\n");
	 else printf("No\n");
	}
	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