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了#include<stdio.h> #include<string.h> sorting(char *a,int n) { int i,l,max;char temp; for(i=0;i<n-1;i++) { max=i; for(l=i+1;l<n;l++) if(a[max]<a[l]) max=l; temp=a[max]; a[max]=a[i]; a[i]=temp; } } main() { char f[110],g[110];int k,r,n1,n2; while(scanf("%s\n%s",f,g)!=EOF) { n1=strlen(f); n2=strlen(g); sorting(f,n1); sorting(g,n2); r=g[0]-f[0]; for(k=1;k<n1;k++) { if(f[k]+r!=g[k]) break; } if(k==n1) printf("YES\n"); else printf("NO\n"); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator