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 inforyou at 2007-05-16 19:19:32 on Problem 2192
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
	int n,k = 0,i,j,flag,len1,len2,len3;
	char s1[201],s2[201],s3[201];
	scanf("%d",&n);
	while(n--)
	{
		k++;
		flag =0;
		scanf("%s%s%s",s1,s2,s3);
		len1 = strlen(s1);
		len2 = strlen(s2);
		len3 = strlen(s3);
		for(j = 0,i = 0; j < len3 && i < len1;)
		{
			if(s1[i] == s3[j])
			{
				i++;j++;
			}
			else j++;
		}
		if(i == len1) flag = 1;
		else printf("Data set %d: no\n",k);

		if(flag == 1)
		{
			for(i = 0,j=0; i < len2 && j < len3;)
			{
				if(s2[i] == s3[j])
				{
					i++;j++;
				}
				else j++;
			}
		    if(i == len2) printf("Data set %d: yes\n",k);
			else printf("Data set %d: no\n",k);
		}
	}
	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