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 |
帮忙看下 感激不尽 我用的是查找各个字母的个数做的 为什么总是错啊#include<stdio.h> #include<string.h> int main() { char cput[100],cget[100]; int counter1[26]={0},counter2[26]={0}; int i,j=0; gets(cput); gets(cget); if(strlen(cput)!=strlen(cget)) printf("NO\n"); else { int x=strlen(cget); for(i=0;i<x;i++) { if(cput[i]!='A') { cput[i]--; } else { cput[i]='Z'; } } for(i=0;i<x;i++) { counter1[cget[i]-'A']++; } for(i=0;i<x;i++) { counter2[cput[i]-'A']++; } for(i=0;i<26;i++) { if(counter1[i]!=counter2[i]) { j++; } } if(j==0) { printf("YES\n"); } else { printf("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