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 |
一个字母同时出现多次要输出多次,读入也有问题,空串也是输入。In Reply To:wa得不行了~~~~~~~~~~~~~~~~~WHO CAN TELL ME WHY!~ Posted by:zwf at 2005-10-04 16:46:08 > #include "stdio.h" > #include "string.h" > int main() > { > char a[10000],b[10000]; > int i,flag1[26],flag2[26]; > L1: while (gets(a)) > { > if (a[0]=='\0') goto L1; > L2: gets(b); > if (b[0]=='\0') goto L2; > memset(flag1,0,sizeof(flag1)); > memset(flag2,0,sizeof(flag2)); > for (i=0;i<strlen(a);i++) > flag1[a[i]-97]=1; > for (i=0;i<strlen(b);i++) > flag2[b[i]-97]=1; > for (i=0;i<26;i++) > if (flag1[i]&&flag2[i]) printf("%c",i+97); > printf("\n"); > } > return 0; > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator