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

who can help me??wa了好多次了。hawk大哥帮帮忙!

Posted by wqfcr at 2005-03-23 11:44:59 on Problem 1936
#include <iostream.h>
#include <string.h>
char a[100000001],b[100000001];
long lena,lenb,ok;
void print()
{
	if(ok==0)
		cout<<"No"<<endl;
	else
		cout<<"Yes"<<endl;
}
int main()
{
	long p,q;
	while(cin)
	{
		
		cin>>a;cin>>b;ok=0;
		lena=strlen(a);lenb=strlen(b);
		p=0;q=0;
		for(long r=lena;r>=1;r--)
		{
			while(b[q]!=a[p]&&q<lenb-1)
			{
		    	q++;
			}
			if(b[q]!=a[p])
				break;
			p++;q++;
		}
		if(r==0)
			ok=1;
		print();
	}
	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