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 |
chengxuIn Reply To:我用文件结束怎么 超时阿!!!!!!!!!!!! Posted by:wcp at 2005-07-20 14:49:31 #include "stdio.h" #include "ctype.h" #include "string.h" int main() { char s[1000][10]={'\0'},ss[1000][10]={'\0'},s1[22]={'\0'}; int i,j,k,flag; i=0;j=0; while(1) { gets(s1);flag=0;j=0; if(strcmp(s1,"\0")==0) break; for(k=0;k<20;k++) { if(s1[k]==' ') { flag=1;j=0; continue; } if(flag==0) s[i][j++]=s1[k]; if(flag==1) ss[i][j++]=s1[k]; } i++; } while(scanf("%s",s1)!=EOF) { flag=0; for(j=0;j<i;j++) { if(strcmp(s1,ss[j])==0) { printf("%s\n",s[j]); flag=1; } if(flag==1) break; } if(flag==0) printf("eh\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