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

在我电脑上完全正确啊,怎么就wrong了呢,高手看看哪里问题吧

Posted by lzwyelang at 2007-09-29 01:08:28 on Problem 3302
#include<iostream.h>//3302 
#include<stdio.h>
void main()
{
	int n,m=0;
	cin>>n;
	for(int v=0;v<n;v++)
	{
		char a[100],b[100],*p,*q;
		scanf("%s",a);
		scanf("%s",b);
		p=a;
		q=b;
		while(*q!='\0'&&*p!='\0')
		{
			if(*p==*q)
			{
			  p++;q++;
			}
		    else p++;			
		}
		if(*q!='\0')
		{
			m=1;
		}
		else 
		{
			while(*p!='\0')
				p++;
		}
		p--;q=b;
		while(q!='\0'&&p>=a)
		{
			if(*p==*q)
			{
			  p--;q++;
			}
		    else p--;			
		}
		if(*q=='\0'||m==0)
		{
			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