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

为啥在我的电脑上就能过,但就是被RE了呢?性质太恶劣了。大牛们,指点指点小弟吧!

Posted by 597503076 at 2009-03-02 19:08:36 on Problem 3302
#include<stdio.h>
#include<stdlib.h>
#include<string.h>


int Finds(int i,char c,char s[]);


int main()
{
	unsigned int n,i,g,h,d,r,p,k;
	char s[110];
	char t[110];
	scanf("%d",&n);
	
	for(i=0;i<n;i++)
	{
		h=0;
	    d=0;
	    p=0;

		scanf("%s	%s",s,t);
		for(g=0;g<strlen(s)&&h<strlen(t);g=d)
		{
			d=Finds(g,t[h],s);
			h++;
		}
		for(r=strlen(t)-1,k=0;k<strlen(s)&&r>=0;k=p)
		{
			p=Finds(k,t[r],s);
			r--;
		}
		if(h==strlen(t)-1)
		{
			printf("YES\n");
		}
		else if(r==0)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}

	}
	return 0;
}

int Finds(int i,char c,char s[])
{
	unsigned int j,k;
	for(j=i;j<strlen(s);j++)
	{
		if(s[j]==c)
		{
			k=j;
		}
	}
	return k;
}



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