hdu 5058 So easy
题目连接
http://acm.hdu.edu.cn/showproblem.php?pid=5058
So easy
Description
Small W gets two files. There are n integers in each file. Small W wants to know whether these two files are same. So he invites you to write a program to check whether these two files are same. Small W thinks that two files are same when they have the same integer set.
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
Multi test cases (about 100). Each case contain three lines. The first line contains one integer n represents the size of file. The second line contains n integers
$a_1, a_2, a_3, \ldots, a_n$ - represents the content of the first file. The third line contains n integers $b_1, b_2, b_3, \ldots, b_n$ - represents the content of the second file.
Process to the end of file.
$1 \leq n \leq 100$
$1 \leq a_i , b_i \leq 1000000000$
Output
For each case, output "YES" (without quote) if these two files are same, otherwise output "NO" (without quote).
Sample Input
3
1 1 2
1 2 2
4
5 3 7 7
7 5 3 3
4
2 5 2 3
2 5 2 5
3
1 2 3
1 2 4
Sample Output
刷些水题打发时间。。
#include<cstdio>
#include<set>
using std::set;
set<int> A, B;
int main() {
int n, v;
while (~scanf("%d", &n)) {
for (int i = ; i < n << ; i++) {
scanf("%d", &v);
if (i < n) A.insert(v);
else B.insert(v);
}
if (A == B) puts("YES");
else puts("NO");
A.clear(), B.clear();
}
return ;
}
hdu 5058 So easy的更多相关文章
- HDU 5572 An Easy Physics Problem (计算几何+对称点模板)
HDU 5572 An Easy Physics Problem (计算几何) 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=5572 Descripti ...
- BestCoder12 1001.So easy(hdu 5058) 解题报告
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5058 (格式有点问题,为了方便阅读---整个复制下来吧) 题目意思:给出两个长度都为 n 的集合你,问 ...
- hdu 5475 An easy problem(暴力 || 线段树区间单点更新)
http://acm.hdu.edu.cn/showproblem.php?pid=5475 An easy problem Time Limit: 8000/5000 MS (Java/Others ...
- HDU 5475 An easy problem 线段树
An easy problem Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pi ...
- 数据结构(主席树):HDU 4729 An Easy Problem for Elfness
An Easy Problem for Elfness Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 65535/65535 K (J ...
- HDU 4565 So Easy(矩阵解公式)
So Easy [题目链接]So Easy [题目类型]矩阵解公式 &题解: 感觉这种类型的题都是一个套路,这题和hdu 2256就几乎是一样的. 所以最后2Xn就是答案 [时间复杂度]\(O ...
- hdu 5058 set应用
http://acm.hdu.edu.cn/showproblem.php?pid=5058 set应用 水题 #include <cstdio> #include <cstdlib ...
- HDU 2132 An easy problem
http://acm.hdu.edu.cn/showproblem.php?pid=2132 Problem Description We once did a lot of recursional ...
- HDU 5650 so easy 数学
so easy 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5650 Description Given an array with n integ ...
随机推荐
- jQuery中 wrap() wrapAll() 与 wrapInner()的区别
今晚看书的时候发现jQuery有三个包裹节点的方法,百度了一下jQuery wrap() / wrapAll() / wrapInner(),果然搜索结果 W3School的文档说明是排第一的. 可是 ...
- 谷歌浏览器提示Adobe Flash Player因过期而遭到阻止
解决方法: 1.下载最新版本chrome://plugins/ 到官网Adobe Flash Player 下载最新版本,目前20 https://get.adobe.com/cn/flashplay ...
- 百度地图API示例之文本标注
代码 <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" cont ...
- C# 多线程---------<一>
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- 4种kill某个用户所有进程的方法
在linux系统管理中,我们有时候需要kill掉某个用户的所有进程,初学者一般先查询出用户的所有pid,然后一条条kill掉,或者写好一个脚本,实际上方法都有现成的,这边有4种方法,我们以kill用户 ...
- javaSE第十七天
第十七天 168 1:登录注册案例(理解) 169 A:用户注册案例的分析 169 B:用户注册案例的源码 170 1: cn.itcast.pojo.User.java ...
- C#基础-可访问性-public、ptotected、protected internal、internal、private
1.类型的可访问性 a.关键字有public.internal,其中public表示该类型对于程序集都可见.internal表示该类型仅对当前程序集可见.此处的类型可以为类.接口.结构等. b.如果不 ...
- SQL Server 触发器创建、删除、修改、查看示例
一﹕ 触发器是一种特殊的存储过程﹐它不能被显式地调用﹐而是在往表中插入记录﹑更新记录或者删除记录时被自动地激活.所以触发器可以用来实现对表实施复杂的完整性约`束. 二﹕ SQL Server为每个触发 ...
- JMeter2.13进行压力测试
1.安装 2. 样本数目 总共发送到服务器的请求数. 最新样本 代表时间的数字,是服务器响应最后一个请求的时间 吞吐量 是服务器每分钟处理的请求数. 平均值 是总运行时间除以发送到服务器的请求数. 中 ...
- PHP数组在HTML之中的应用
<select name="data[status]" id="" <?php if(in_array($list['status'],array( ...