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 |
本人比较笨,贡献了n个WA,那位牛人帮忙看下啦(C做的)#include <stdio.h> #include <string.h> void main() { int i,j,n,x,y,m,cl,dl,c[200],d[200]; char a[200],b[200]; gets(a); gets(b); for (i=0;i<200;i++) c[i]=d[i]=1; m=n=strlen(a); cl=dl=0; for (i=0;i<m;i++) { cl++; for (j=i+1;j<m;j++) if (a[i]==a[j]) { for (x=j;x<m;x++) a[x]=a[x+1]; m--; c[cl]++; } } for (i=0;i<n;i++) { dl++; for (j=i+1;j<n;j++) if (b[i]==b[j]) { for (x=j;x<n;x++) b[x]=b[x+1]; n--; d[dl]++; } } if (cl!=dl) printf("NO\n"); else { x=0; for (i=1;i<cl;i++) for (j=1;j<dl;j++) if (c[i]=d[j]) { for (y=j;y<dl;y++) d[y]=d[y+1]; x=1;dl--;break; } if (x==0) printf("NO\n"); else printf("YES\n"); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator