Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
为什么还是WA啊?(附程序)为什么还是WA啊? #include<stdio.h> #include<string.h> int main() { char a[10][100]; int i,j,m,n,count,flag1[100],flag2,k,next,hujk; char b[500],c[50],temp,d[500];; scanf("%d%d",&m,&n); for(i=1;i<=m;i++) {scanf("%s",a[i]);} for(j=0;j<n;j++) { count=0;flag1[0]=0;flag2=0;next=0;hujk=0; temp=getchar();gets(b); if(temp>='A'&&temp<='Z')temp='a'+temp-'A'; for(i=0;b[i]!='\0';i++) { if(b[i]>='A'&&b[i]<='Z')b[i]='a'+b[i]-'A'; if(b[i]<'a'||b[i]>'z')b[i]=' '; } hujk=0; for(i=0;b[i]!='\0';i++) { if(i==0&&j>0){hujk=1;c[0]=temp;} if(b[i]==' '){hujk=0;count++;} else c[hujk++]=b[i]; c[hujk]='\0'; if(strcmp(c,"beautiful")==0)flag2=1; if(strcmp(c,"pretty")==0)flag2=1; if(strcmp(c,"lovely")==0)flag2=1; for(k=1;k<=m;k++) if(strcmp(c,a[k])==0) { next=0; while(flag1[next]!=0)next++; flag1[next]=k; flag1[next+1]=0; } } if(flag1[0]==0)printf("All: "); for(i=0;flag1[i]!=0;i++) { printf("%s",a[flag1[i]]); if(flag1[i+1]==0) printf(": "); else printf(" "); } if(count<10) printf("oh\n"); if(count>9) { if(flag2==1) printf("xixi\n"); else printf("hehe\n"); } } return 1; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator