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

1677 为什么还是wa??????跪求大牛啊!!

Posted by a373160834 at 2011-07-11 14:45:19 on Problem 1677
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
int g,w,i,p,q,l,j,qinggan,sum,r;
int f[5];
char a[5][20],wish[202],wish2[35][200];
scanf("%d%d",&g,&w);
getchar();
for(i=0;i<g;i++)
{scanf("%s",a[i]);getchar();}
//for(i=0;i<g;i++)
//{
//printf("%s\n",a[i]);}
while(w--)
{
sum=0;
r=0;
for(i=0;i<g;i++)
f[i]=1;
p=0;q=0;
gets(wish);
l=strlen(wish);
for(j=0;j<l;j++)
if(wish[j]!=' '&&wish[j]!='!')
{if(wish[j]>=65&&wish[j]<=90)wish2[p][q]=wish[j]+32;
else wish2[p][q]=wish[j];q++;}
else {wish2[p][q]='\0';p++;q=0;}
//for(i=0;i<p;i++)
//printf("%s\n",wish2[i]);
if(p<=9) qinggan=1;
else for(i=0;i<p;i++)
if(strcmp(wish2[i],"beautiful")==0||strcmp(wish2[i],"pretty")==0||strcmp(wish2[i],"lovely")==0)
{qinggan=2;break;}
else qinggan=3;
for(i=0;i<g;i++)
{for(j=0;j<p;j++)
if(strcmp(a[i],wish2[j])==0)
{f[i]=0;break;}
if(j<p) sum++;
//printf("%d\n",sum);
}
if(sum==0) printf("All:");
else for(i=0;i<g;i++)
if(f[i]==0){if(r<sum-1) printf("%s ",a[i]);if(r==sum-1) printf("%s:",a[i]);r++;}
if(qinggan==1) printf(" oh\n");
else if(qinggan==2) printf(" xixi\n");
else if(qinggan==3)printf(" hehe\n");
}
 //system("pause");
 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