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

30A 纪念 附代码

Posted by songruirui at 2013-03-05 18:22:21 on Problem 1936
#include <string>
#include <iostream>
#include <cstdio>
#include <memory.h>
using namespace std;
bool findsub(string a,string b)
{
    if(a.size()>b.size())
        return false;
    else
    {
        int loc=-1;
        for(int i=0;i<a.size();i++)
        {
            loc=b.find(a[i],loc+1);
            if(loc==string::npos)
                return false;
        }
        return true;
    }

}
int main()
{
	//freopen("d:\\in.txt","r",stdin);
	//freopen("d:\\out.txt","w",stdout);
    string a,b;
	a.resize(100000);
	b.resize(100000);
    while(cin>>a>>b)
    {
        if(findsub(a,b))
            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