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 woshimi at 2009-03-18 13:19:30 on Problem 1677 and last updated at 2009-03-19 10:35:40
已完善的有  开头大小写同样可以识别 同句出现多次的名字输出不回重复
#include <stdio.h>
#include <string.h>
void dele(int i,int xx[])
{
	int j;
	for(j=0;j<10;j++)
		if(xx[j]==i)
			xx[j]=0;
}
int main(void)
{
	int g,w,i=0,m=-1,l=0,j,n,flag=0,flag2=0,xx[10],q=0;
	char x,girl[10][10],wish[30][400],word[30][100][20];
	char good[6][10]={"beautiful","pretty","lovely","Beautiful","Pretty","Lovely"};
	scanf("%d %d",&g,&w);
	scanf("%c",&x);
	i=g;
	while(i<g*2)
	{
		scanf("%s",girl[i]);
		i++;
	}
	i=0;
	while(i<g)
	{
		strcpy(girl[i],girl[i+g]);
		girl[i][0]=girl[i][0]-32;
		i++;
	}
	scanf("%c",&x);
	i=0;
	while(i<w)
	{
		gets(wish[i]);
		i++;
	}
	for(n=0;n<w;n++)
	{
		for(j=0;wish[n][j]!='\0';j++)
		{
			if(wish[n][j]>='A'&&wish[n][j]<='z')
			{
				m++;
				word[n][l][m]=wish[n][j];
			}
			else if((!(wish[n][j]>='A'&&wish[n][j]<='z'))&&(wish[n][j+1]>='A'&&wish[n][j+1]<='z'))
			{
				m++;
				word[n][l][m]='\0';
				l++;
				m=-1;
			}
		}
		word[n][l][m+1]='\0';
		word[n][l+1][0]='\0';
		m=-1;
		l=0;
	}
	for(n=0;n<w;n++)
	{
		for(j=0;j<100;j++)
		{
			for(i=0;i<g*2;i++)
			{
				if(strcmp(word[n][j],girl[i])==0)
				{
					if(i>=g)
					{
						 xx[q]=i;
						 q++;
					}
					else if(i<g)
					{
						xx[q]=i+g;
						q++;
					}
					flag=1;
				}
			}
			for(i=0;i<6;i++)
			{
				if(strcmp(word[n][j],good[i])==0)
				{
					flag2=1;
				}
			}
		}
		if(flag==1)
		{
		for(i=g;i<g*2;i++)
		{
		for(j=0;j<g*2;j++)
		{
			if(i==xx[j])
			{
				printf("%s ",girl[i]);
				dele(i,xx);
			}
		}
		}
		}
		if(word[n][9][0]<'A'||word[n][9][0]>'z')
			flag2=2;
		if(flag==0)
			printf("All ");
		printf("\b: ");
		if(flag2==0)
			printf("hehe");
		else if(flag2==1)
			printf("xixi");
		else if(flag2==2)
			printf("oh");
		printf("\n");
		flag2=0;
		flag=0;
		q=0;
		for(i=0;i<10;i++)
			xx[i]=0;
	}
	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