HDU5058
So easy
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 991 Accepted Submission(s): 547
Problem Description
For example file A contains (5,3,7,7),and file B contains (7,5,3,3). They have the same integer set (3,5,7), so they are same.
Another sample file C contains(2,5,2,5), and file D contains (2,5,2,3).
The integer set of C is (2,5),but the integer set of D is (2,3,5),so they are not same.
Now you are expected to write a program to compare two files with size of n.
Input
Process to the end of file.
1≤n≤100
1≤ai,bi≤1000000000
Output
Sample Input
Sample Output
//2016.8.12
#include<iostream>
#include<cstdio>
#include<set> using namespace std; int main()
{
int n;
while(cin>>n)
{
set<int> seta;
set<int> setb;
int a, b;
bool fg = true;
for(int i = ; i < n; i++)
{
scanf("%d", &a);
seta.insert(a);
}
for(int i = ; i < n; i++)
{
scanf("%d", &b);
setb.insert(b);
}
if(seta.size()!=setb.size())
fg = false;
else{
set<int>::iterator it;
for(it = seta.begin(); it != seta.end(); it++)
{
if(setb.count(*it)==)
fg = false;
}
}
if(fg)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
} return ;
}
HDU5058的更多相关文章
随机推荐
- 17.4.3 使用MulticastSocket实现多点广播(4)
17.4.3 使用MulticastSocket实现多点广播(4) 通过UserInfo类的封装,所有客户端只需要维护该UserInfo类的列表,程序就可以实现广播.发送私聊信息等功能.本程序底层通 ...
- Delphi 悬浮窗口、浮动窗口的实现
源:Delphi 悬浮窗口.浮动窗口的实现 浮动窗体的实现 http://blog.tianya.cn/blogger/post_show.asp?BlogID=68097&PostID=80 ...
- 电池和Adapter切换电路改进实验(转)
源:电池和Adapter切换电路改进实验 目的:很多单电池的机器在大负载的情况下,如把背光开到最亮,运行3D游戏,此时拔DC电源很容易出现机器死机,或花屏现象: 原因:Q5的导通时间不够,希望通过G极 ...
- (二)Jquery Mobile介绍以及Jquery Mobile页面与对话框
Jquery Mobile介绍以及Jquery Mobile页面与对话框 一. Adobe Dreamweaver CS6 环境 最新版本的cs6会支持JM的使用,有自动提示功能,很强大.安装说明地 ...
- 链接器工具错误 LNK1123
由于新学C++变成,找不到人求教,所以这个问题困扰了我很久,今天终于找到终极解决方案了: 出处,此帖25楼: http://bbs.csdn.net/topics/390121452 终极解决方案:V ...
- Unity 3d中Shader是什么,可以吃吗?
众所周知,Unity3d是一款跨平台非常广的游戏引擎,上手容易,界面友好,集成功能众多,是目前开发手游的主流引擎.本人有幸使用Unity 3d进行开发已一年多时间,已领略了这歀引擎的强大之处. 编写s ...
- Xcode的管理工具
Xcode插件管理工具Alcatraz Alcatraz 1.简介 Alcatraz是一个能帮你管理Xcode插件丶模版及颜色配置的工具.它可以直接集成在Xcode的图形界面中,让你感觉就像在使用Xc ...
- input有许多,点击按钮使用form传递文本框的值
input有许多,点击按钮使用form传递文本框的值 <form name="form1" method="post" action="< ...
- (中等) POJ 2528 Mayor's posters , 离散+线段树。
Description The citizens of Bytetown, AB, could not stand that the candidates in the mayoral electio ...
- angular中的$http配置和参数
依赖:$httpBackend $cacheFactory $rootScope $q $injector 使用:$http(config); 参数: method:字符串,请求方法. url:字符串 ...