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

我用string做的不知道厚道不厚道

Posted by HIT_Happy at 2010-04-07 14:00:10 on Problem 3753
In Reply To:Re:哪位过的大神把代码贴出来瞧瞧。。。 Posted by:ctzsm at 2010-01-17 22:00:40
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
//3753
int main(void)
{
	string strSource,strTemp;
	while(cin>>strSource)
	{
		while(cin>>strTemp)
		{
			if(strTemp == "END")
				break;
			int index = strSource.find(strTemp);
			if(strTemp == "NULL")
				cout<<0<<" "<<"NULL"<<endl;
			else if(index == string::npos)
				cout<<strSource.length()<<" "<<strSource<<endl;
			else if(index == 0)
				cout<<0<<" "<<"NULL"<<endl;
			else
				cout<<index<<" "<<strSource.substr(0,index)<<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