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 windbells at 2004-06-28 11:31:27 on Problem 1677
#include<stdio.h>
#include<string.h>
#include<ctype.h>
int main()
{
	char name[7][40],answer[7],arry[230],keyc[80];
	int g,w,i,size,keyn,j,key,k,l,ch,a;
	scanf("%d%d",&g,&w);
	for(i=0;i<g;i++)
		scanf("%s",name[i]);
	getchar();
	for(i=0;i<w;i++)
	{
		for(j=0;j<g;j++)
			answer[j]=0;
		keyn=0;key=0;
		gets(arry);
		size=strlen(arry);
		k=0;ch=0;
		for(j=0;j<size-1;j++)
		{
			if(isupper(arry[j]))
				arry[j]+=32;
			if(islower(arry[j]))
			{
				keyc[k++]=arry[j];
				continue;
			}
			if((arry[j+1]==' ')||(arry[j+1]=='!'))
				continue;
			keyc[k]='\0';
			for(l=0;l<g;l++)
				if(strcmp(keyc,name[l])==0)
				{
					keyn++;
					answer[l]=1;
				}
			if((strcmp(keyc,"beautiful")==0)||(strcmp(keyc,"pretty")==0)||(strcmp(keyc,"lovely")==0))
				key++;
			k=0;
			ch++;
		}
		if(keyn==0)
			printf("All");
		else 
		{
			a=0;
			for(j=0;j<g;j++)
				if(answer[j]==1)
				{
					if(a==0)
						printf("%s",name[j]);
					else printf(" %s",name[j]);
					a++;
				}
		}
		if(ch<10)
			printf(": oh\n");
		else if(key!=0)
			printf(": xixi\n");
		else printf(": hehe\n");
	}
}

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