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 yuziquan at 2017-05-22 11:11:20 on Problem 2159
#include<iostream>
#include<algorithm>
using namespace std;
char t1[26], t2[26], s[101];
int main(void)
{
	cin >> s;
	for (int i = 0; s[i]; i++)  t1[s[i] - 'A']++;
	cin >> s;
	for (int i = 0; s[i]; i++) t2[s[i] - 'A']++;
	sort(t1, t1 + 26);
	sort(t2, t2 + 26);
	for (int i = 0; i < 26; i++)
	{
		if (t1[i] != t2[i])
		{
			cout << "NO\n";
				return 0; 
		}
	}
	cout << "YES\n";
	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