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 ...
随机推荐
- 【LeetCode】7. Reverse Integer 整型数反转
题目: Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 思路:不 ...
- Eclipse 工作目录被破坏,导致Eclipse 打不开
由于之前一直使用的的是 visual studio 的开发工具,对 java 的 Eclipse 工具比较陌生,在使用 eclipse 的过程中误删了工作目录的部分文件,导致在在下次启动 eclips ...
- linux 将foo制定n, m之间行的内容, 追加到bar文件
sed -ne '196, 207 p' foo >> bar;把文件foo 196-行207行的内容追加到 bar文件
- (转)各种排序算法的分析及java实现
转自:http://www.cnblogs.com/liuling/p/2013-7-24-01.html 排序一直以来都是让我很头疼的事,以前上<数据结构>打酱油去了,整个学期下来才勉强 ...
- 【EF 3】浅谈ADO数据模型生成串(一):csdl,ssdl,msl分析
导读:这段经历,真的是难以忘怀.恨得我牙痒痒,就一个字符串拼接,前前后后尽然报了不下30个错.有的错很快就能调出来,有的错调一天.两天,是真的可以的.最终总结了一下,这些错很大一部分原因是对于EF生成 ...
- 用代码给TABLE 添加字段,设置属性并编译
AOTTableFieldList AOTTableFieldList ,TableFieldNode; TableName tableName = "SML_InventTableExt& ...
- DedeCMS中function='Html2Text(@me)的用法分析
本文实例讲述了DedeCMS中function='Html2Text(@me)的用法.分享给大家供大家参考.具体分析如下: 在使用dedecms建站网站时候,需要用到过滤html代码,调出纯文本的代码 ...
- Windows server 2008 R2远程桌面终端连接数的破解
Windows server 2008 R2远程桌面终端连接数的破解 日常工作中,经常需要远程连接到服务器上,然而在公司里,老总.同事都需要连接到服务器上,而默认的服务器系统同时连接的最大连接数只有2 ...
- HttpClient——连接关闭
HttpClient client = new HttpClient(); HttpMethod method = new GetMethod("http://www.apache.org& ...
- Unieap3.5-需要用到window.setTimeout的地方
1.js大数据量操作且需要显示进度条 unieap.showLoading(true);//进度条 window.setTimeout(function(){ checkUtils.setAllRow ...