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

瞎折腾

Posted by jyjyq at 2010-08-02 08:41:23 on Problem 2159
#include <iostream>
using namespace std;
int cmp(const void *a,const void *b)
{
    return (*(int *)a-*(int *)b);
}
int main()
{
    char a[101]={100},b[101]={100};//
    int count,count1[26]={0},count2[26]={0}; 
    int i,len;
    cin>>a>>b;
    len=strlen(a);
    for(i=0;i<len;i++){
        count1[a[i]-'A']++;
        count2[b[i]-'A']++;
    }
    qsort(count1,26,sizeof(int),cmp);
    qsort(count2,26,sizeof(int),cmp);
    
    for(i=0;i<26;i++)
        if(count1[i]!=count2[i])break;
    if(i==26)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
   // system("pause");
    return 0;
}
 

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