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 ??????????????????In Reply To:Re:为什么总是WA,我的理解有误吗? Posted by:Hzj_jie at 2005-11-19 00:30:12 # include <iostream.h> # include <stdlib.h> # include <stdio.h> # include <string.h> int cmp(const void * a,const void * b) { return *( char*)a-*(char *)b; } char s1[110]; char s2[110]; int done(char * a,char * b,int l1,int l2) { int jian=a[0]-b[0]; if(l1!=l2) return 0; for(int i=1;i<l1;i++) { if(a[i]-b[i]!=jian) return 0; } return 1; } int main() { int len1=0,len2=0; cin>>s1; cin>>s2; len1=strlen(s1); len2=strlen(s2); qsort(s1,len1,sizeof(char),cmp); qsort(s2,len2,sizeof(char),cmp); cout<<s1<<"\n"; cout<<s2<<"\n"; if(done(s1,s2,len1,len2)) cout<<"YES\n"; else cout<<"NO\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