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 spb3732 at 2012-12-24 20:35:53 on Problem 1936
#include<cstdio>
#include<cstring>
using namespace std;
const int STRLEN=100001;
char strS[STRLEN];
char strT[STRLEN];
int main()
{
	while(scanf("%s%s",strS,strT)!=EOF)
	{
		int nTIndex=strlen(strT)-1;  ///指向最后一个字符,用于从后向前遍历
		int nSIndex=strlen(strS)-1;

		while(nTIndex>=0&&nSIndex>=0)
		{
			if(strT[nTIndex--]==strS[nSIndex])
			{
				nSIndex--;
			}
		}
		if(nSIndex==-1)
			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