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

## Re:C++有毒，用G++过题

Posted by ALLACS at 2017-09-29 20:26:03 on Problem 2159
In Reply To:C++有毒，用G++过题 Posted by:ALLACS at 2017-09-29 20:20:01
```#include <iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
const char *s="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const int maxn=26;
int a[maxn],b[maxn];
string maze;
string org;
int main()
{
cin>>maze>>org;
memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
if(maze.length()!=org.length()) printf("NO\n");
else {
for(int i=0;i<maxn;i++)
{
for(int j=0;j<org.length();j++)
{
if(s[i]==org[j]) a[i]++;
if(s[i]==maze[j]) b[i]++;
}
}
sort(a,a+maxn);
sort(b,b+maxn);
int t=1;
for(int i=0;i<maxn;i++)
if(a[i]!=b[i]) {
t=0;
break;
}
if(t) printf("YES\n");
else printf("NO\n");
}
return 0;
}```

Followed by: