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 |
Re:不知为何,就是WA,请指教In Reply To:不知为何,就是WA,请指教 Posted by:vcjsp at 2011-02-06 11:08:13 > char src[]="you"; > char dst[]="we"; > int len_src=strlen(src); > int len_dst=strlen(dst); > char s[1001]; > char result[1001]; > int index_s; > int index_result; > int i; > int len; > while(gets(s)!=NULL) > { > len=strlen(s); > index_s=0; > index_result=0; > while(index_s<len) > { > for(i=0; i<len_src; i++) > { > if(s[index_s]!=src[i]) > { > result[index_result++]=s[index_s++]; > break; > } > else > { > index_s++; > } > } > if(i==len_src) > { > strcpy(&result[index_result],dst); > index_result+=len_dst; > } > } > result[index_result]='\0'; > printf("%s\n",result); > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator