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

Re:为什么我101就过了?

Posted by 15979203898 at 2018-04-14 16:06:30 on Problem 2159
In Reply To:测试数组大小100没过,105ac了 Posted by:20162430206 at 2018-04-01 14:55:30
#include <iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int main()
{
	char a[101]="", b[101]="";
	int x[26]={0}, y[26]={0}, i, len1, len2;
	
	cin >> a >> b;
	len1 = strlen(a), len2 = strlen(b);
	
	for (i = 0; i < len1; i++)
		x[a[i] - 'A']++;
	for (i = 0; i < len2; i++)
		y[b[i] - 'A']++;

	sort(x, x + 26);
	sort(y, y + 26);

	for (i = 0; i < 26; i++)
	{
		if (x[i] != y[i])
		{
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << 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