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的更多相关文章
随机推荐
- appium通过WiFi连接真机进行测试
http://www.th7.cn/Program/Android/201507/514602.shtml appium通过WiFi连接真机进行测试 2015-07-24 19:43:07CSDN ...
- 《accelerated c++》---------第六章
本章主要讲了算法部分.就是<algoruthm>里面的算法.
- JSTL c标签,fn标签,fmt标签 - 生活在爪洼岛上 - ITeye技术网站
jstl是sun定义的标准,由apache实现,所以要下载jar包的话去apache,要看api文档的话,去sun,API文档在此:http://java.sun.com/products/jsp/j ...
- POJ 2251 Dungeon Master(地牢大师)
p.MsoNormal { margin-bottom: 10.0000pt; font-family: Tahoma; font-size: 11.0000pt } h1 { margin-top: ...
- BufferedReader 输出与BufferedWriter 输入的用法
public static void main(String[] args) { String content[] = {"好久不见了","最近好吗",&qu ...
- 1、手把手教你Extjs5(一)搭建ExtJS5环境
Ext JS 5 的主要特性包括: 新的数据绑定方式 新增支持 MVVM 模式,并且依然支持 MVC 模式 对手持设备更友好,针对触屏设备进行优化 新的主题 Crisp / Neptune Touch ...
- iOS-模糊查询
http://blog.csdn.net/qq_33701006/article/details/51836914 版权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[+] 前言 ...
- STM32/GD32芯片信息(转)
源:STM32/GD32芯片信息 因为需要自动适配芯片进行系统配置,所以我们有必要通过读取一些系统寄存器来获取必要信息.我们的代码需要兼容STM32F1/GD32F1/STM32F0/STM32F4 ...
- USB那点事3 -使用端口2作为custom HID的传输(转)
源:USB那点事3 -使用端口2作为custom HID的传输 USB custom HID例子中是使用了端口1作为通信,那么现在我使用端口2作为通信端了,该如何修改呢?如下所示: 首先修改:usb_ ...
- CoordinatorLayout学习笔记
CoordinatorLayout是一个增强型的FrameLayout.它的作用有两个 作为一个布局的根布局 最为一个为子视图之间相互协调手势效果的一个协调布局 代码如下: <?xml vers ...