Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

哪位大牛帮忙看一下啊?为什么WA???

Posted by zhenjie at 2009-05-13 08:55:00 on Problem 2159
#include <stdio.h>
#include<string.h>
int main()
{
    char a[150],b[150];         /*特意开大点的数组*/
    int i,ca[26]={0},cb[26]={0},ta[20]={0},tb[20]={0};
    gets(a);
    gets(b);
    for(i=0;i<=strlen(a)-1;i++)
    {
        ca[a[i]-65]++;
    }
    for(i=0;i<=strlen(b)-1;i++)
    {
        cb[b[i]-65]++;
    }
    for(i=0;i<=25;i++)
    {
        ta[ca[i]]++;tb[cb[i]]++;
    }
    for(i=0;i<=19;i++)
    {
        if(ta[i]!=tb[i])
        {printf("NO\n");break;}
    }
    if(i==20)
    printf("YES\n");
    return 1;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator