您的位置:首页 > 其它

hdu 5058 So easy

2015-07-04 19:40 267 查看
给出2个集合,让你判断是否相等

方法很多,我用map;

#include<iostream>
#include<map>
using namespace std;
map<int,int>mapp;
map<int,int>mappp;
int main()
{
int n;
while(cin>>n)
{
mapp.clear();
mappp.clear();
for(int i=0;i<n;i++)
{
int x;
cin>>x;
if(mapp.find(x)==mapp.end()) mapp[x]=1;
}
int sum=0;
for(int i=0;i<n;i++)
{
int x;
cin>>x;
if(mappp.find(x)==mappp.end()) mappp[x]=1;
}
if(mapp==mappp) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: