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 kric at 2007-04-07 20:19:01 on Problem 2973
#include<iostream>
using namespace std;
int main()
{
	int n,cnt,i,j,k,count,len,len1,ext;
	char p[1000][8],b[8];
	while(1)
	{
		cnt=0;
		cin>>n;
		getchar();
		if(!n) break;
		for(i=0;i<n;i++)
		{
			gets(p[i]);
		}
		gets(b);
		len=strlen(b);
		for(i=0;i<n;i++)
		{
			ext=0;
			count=0;
			len1=strlen(p[i]);
			if(len1>len) continue;
			for(j=0;j<len;j++)
			{
				if(b[j]=='_')
				   {
					   ext++;
					   continue;
				   }
               for(k=0;k<len1;k++)
			   {
                   if(p[i][k]=='\0')
					   continue;

				   if(b[j]==p[i][k])
				   {
					   count++;
					   p[i][k]='\0';
				   }
			   }
			} 
			if(count+ext>=len1)
			{
				cnt++;
				continue;
			}
		}
		printf("%d\n",cnt);
	}
	return	1;
}

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