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

vector写法,dalao莫喷

Posted by mbath at 2018-08-06 21:33:05 on Problem 2159
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
using namespace std;
int main()
{
    string str1,str2;
    while(cin>>str1>>str2){
        vector<int>v1(30),v2(30);
        for(int i=0;i<str1.size();++i)v1[str1[i]-'A']++;
        for(int i=0;i<str2.size();++i)v2[str2[i]-'A']++;
        sort(v1.begin(),v1.end());
        sort(v2.begin(),v2.end());
        if(v1==v2)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    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