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

为什么老是wa啊??

Posted by 88873350 at 2007-06-16 14:22:37 on Problem 2192
#include <stdio.h>
#include <string.h>
 
int compare(char a[],char b[])
{
	int i,j,k=0,flag=0;
	for(i=0;i<strlen(a);i++)
	{
		for(j=flag;j<strlen(b);j++)
			if(a[i]==b[j]) {k++;break;}
	flag=j+1;
	}
			
			if(k==strlen(a)) return 1;
			else return 0;
}
int main()
{
	char a[200],b[200],c[400];int n,i;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{   
		scanf("%*c");scanf("%s",a);
		scanf("%*c");scanf("%s",b);
		scanf("%*c");scanf("%s",c);
	if(compare(a,c)==1&&compare(b,c)==1) printf("Data set %d: yes\n",i);
	else printf("Data set %d: no\n",i);
	}
	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