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 ...
随机推荐
- Kafka Quick Start
1.Download > tar -xzf kafka_2.11-0.10.0.0.tgz> cd kafka_2.11-0.10.0.0 2.启动zookeeper服务 Kafka使用的 ...
- 让Windows7运行速度更快的BIOS优化设置教程
和以前使用WindowsXP一样,很多用户都在设法提高windows7的系统运行速速,比较常见的方法大多是对系统服务进行优化,去掉一些可有可无的系统服务,还有就是优化资源管理器菜单等.除此之外,还有一 ...
- Solarwinds Orion NPM实战视频演示
Orion Network Performance Monitor是全面的带宽性能监控和故障管理软件,能监控并收集来自路由器.交换机.服务器和其他SNMP设备中的数据,您可以直接从Web浏览器上观察您 ...
- PAT1023. Have Fun with Numbers
//水题,但是考点不水,可能用的strlen属于string库,但是只能用于字符,不能用数字,因为\0就是0.出现0无法判断,其次二倍时有可能有进位 //第一次在二倍进位上出了问题 #include& ...
- PAT1020. Tree Traversals
//典型后中省树,这种方法必须有 中序序列来确定根的位置,然后二分建树: //因为用的vc,之前用序列位置建树通不过,用坐标建树通过了,怀疑vc的功能限制,有时间再来测试,眼下感觉还是坐标好啊,用地址 ...
- .NET 可选择的转型路径(转)
新的一年,您在学习和工作上,想坚守所学,还是尝试转型呢? (1) 继续钻研 C# 4.0 / AJAX / LINQ to AD.LINQ to JavaScript / WF, WCF, WPF, ...
- 从Git仓库中恢复已删除的分支、文件或丢失的commit
亲测可用 因为自己 commit 并且 push 后 因为冲突 提交不了,不小心做了 rebase 代码被 覆盖 用以下命令 还原: 查看所有日志 并记下 hash 值 git reflog 然后用: ...
- 爱之初体验---编译加载内核模块hello
1. hello.c #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h ...
- toggleClass
toggleClass 用来给匹配元素切换类 语法 参考 http://www.w3schools.com/jquery/html_toggleclass.asp $(selector).toggle ...
- sqlserver 保留小数方法
1. 使用 Round() 函数,如 Round(@num,2) 参数 2 表示 保留两位有效数字. 2. 更好的方法是使用 Convert(decimal(18,2),@num) 实现转换,dec ...