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

哪错了??

Posted by blessing at 2005-08-26 11:29:26 on Problem 1318
#include<iostream.h>
#include<string.h>
int main()
{
	char a[100][7],aa[1000][7],pos[6],tet[6];	
	int i,j;
	unsigned len,count=0;
	int sum=0;
	for(i=0;i<100;i++)
	{
		cin>>a[i];		
		if(a[i][0]=='X'&&a[i][1]=='X'&&a[i][2]=='X'&&a[i][3]=='X'&&a[i][4]=='X'&&a[i][5]=='X')
			break;
	}
	for(int ii=0;ii<i;ii++)
	{
		for(int jj=0;jj<i;jj++)
		{
			for(unsigned dd=0;dd<strlen(a[jj])&&dd<strlen(a[ii]);dd++)
			{
				if(a[jj][dd]<a[ii][dd])
				{
					strcpy(tet,a[jj]);
					strcpy(a[jj],a[ii]);
					strcpy(a[ii],tet);					
				}				
			}
		}
	}
	for(j=0;j<100;j++)
	{
		cin>>aa[j];
		if(aa[j][0]=='X'&&aa[j][1]=='X'&&aa[j][2]=='X'&&aa[j][3]=='X'&&aa[j][4]=='X'&&aa[j][5]=='X')
			break;
	}
	for(int k=0;k<j;k++)
	{
		len=strlen(aa[k]);
		for(int kk=0;kk<i;kk++)
		{
			if(len==strlen(a[kk]))
			{
				strcpy(pos,a[kk]);	
				for(unsigned m=0;m<len;m++)
				{
					for(unsigned n=0;n<len;n++)
					{
						if(aa[k][m]==pos[n])
						{
							count++;
							pos[n]='*';
							break;
						}
					}
				}
				if(count==len)
				{
					cout<<a[kk]<<endl;
					sum=1;
				}
				count=0;
			}
		}
		if(sum==0)
			cout<<"NOT A VALID WORD"<<endl;
		cout<<"******"<<endl;
		sum=0;
	}
	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