Problem 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 a1,a2,a3,…,an - represents the content of the first file. The third line contains n integers b1,b2,b3,…,bn - represents the content of the second file.
Process to the end of file.
1≤n≤100
1≤ai,bi≤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
YES
YES
NO
NO
 
 #include <stdio.h> 

 int main(){
int n;
int number;
int i;
int j;
int array1[];
int array2[];
int length1;
int length2;
int temp; while(scanf("%d",&n)!=EOF){
length1=;
for(i=;i<n;i++){
scanf("%d",&number); if(i==){
array1[]=number;
length1++;
continue;
} for(j=;j<length1;j++){
if(number==array1[j])
break;
} if(j==length1){
array1[length1]=number;
length1++;
}
} for(i=;i<length1-;i++){
for(j=i+;j<length1;j++){
if(array1[i]>array1[j]){
temp=array1[i];
array1[i]=array1[j];
array1[j]=temp;
}
}
} /*for(i=0;i<length1;i++)
printf("%d ",array1[i]);
printf("\n");*/ length2=;
for(i=;i<n;i++){
scanf("%d",&number); if(i==){
array2[]=number;
length2++;
continue;
} for(j=;j<length2;j++){
if(number==array2[j])
break;
} if(j==length2){
array2[length2]=number;
length2++;
}
} for(i=;i<length2-;i++){
for(j=i+;j<length2;j++){
if(array2[i]>array2[j]){
temp=array2[i];
array2[i]=array2[j];
array2[j]=temp;
}
}
} /*for(i=0;i<length2;i++)
printf("%d ",array2[i]);
printf("\n");*/ if(length1!=length2){
printf("NO\n");
continue;
} for(i=;i<length1;i++){
if(array1[i]!=array2[i]){
printf("NO\n");
break;
}
} if(i==length1)
printf("YES\n"); } return ;
}

So easy的更多相关文章

  1. 【转】Windows下使用libsvm中的grid.py和easy.py进行参数调优

    libsvm中有进行参数调优的工具grid.py和easy.py可以使用,这些工具可以帮助我们选择更好的参数,减少自己参数选优带来的烦扰. 所需工具:libsvm.gnuplot 本机环境:Windo ...

  2. Struts2 easy UI插件

    一.easy UI是类似于jQuery UI的插件库,它提供了丰富的各种常用插件:tree.datagrid... tree插件: 语法:$(selector).tree([settings]); 常 ...

  3. Easy UI常用插件使用

    一.easy UI是类似于jQuery UI的插件库,它提供了丰富的各种常用插件:tree.datagrid... tree插件: 语法:$(selector).tree([settings]); 常 ...

  4. UVA-11991 Easy Problem from Rujia Liu?

    Problem E Easy Problem from Rujia Liu? Though Rujia Liu usually sets hard problems for contests (for ...

  5. CodeForces462 A. Appleman and Easy Task

    A. Appleman and Easy Task time limit per test 1 second memory limit per test 256 megabytes input sta ...

  6. easy ui插件

    简介: easy UI是类似于jQuery UI的插件库 注意:多脚本同时使用时,注意脚本冲突问题. 常用插件: 1.tree插件(tree插件实现动态树形菜单) 2.datagrid插件(datag ...

  7. 用TPP开启TDD的easy模式

    Test-Drived Development 测试驱动开发三步曲:写一个失败的测试用例->编写生产代码通过这个测试用例(transformation)->重构(refactor).重构是 ...

  8. Easy Sysprep更新日志-skyfree大神

    Easy Sysprep更新日志: Skyfree 发表于 2016-1-22 13:55:55 https://www.itsk.com/forum.php?mod=viewthread&t ...

  9. [官方软件] Easy Sysprep v4.3.29.602 【系统封装部署利器】(2016.01.22)--skyfree大神

    [官方软件] Easy Sysprep v4.3.29.602 [系统封装部署利器](2016.01.22) Skyfree 发表于 2016-1-22 13:55:55 https://www.it ...

  10. [原创] Easy SysLite V1.2 (2016.5.29更新,新增加WIN10支持,一个程序适配所有系统减肥)

    [原创] Easy SysLite V1.2 (2016.5.29更新,新增加WIN10支持,一个程序适配所有系统减肥) nohacks 发表于 2016-5-29 17:12:51 https:// ...

随机推荐

  1. sqlalchemy配置多读写库多连接后的关系设置

    前言 一般来说,解决sqlalchemy 连接多个库的最简单的方式是新建两个或多个db.session 相互没有关联,modle配置不同的db.session来连接,这样的话,relationship ...

  2. 【Linux】小米路由开启SSH访问权限

    一.验证小米路由ROM是否为开发版 1.  登录小米路由Web管理页面,检查ROM版本是否为开发版(若为开发版直接跳至第二步,若为稳定版继续本步骤). 2. 进入小米路由器官网(http://www1 ...

  3. [读书笔记3]《C语言嵌入式系统编程修炼》

    第五章 性能优化   5.1 使用宏定义 在C语言中,宏是产生内嵌代码的唯一方法.对于嵌入式系统而言,为了能达到性能要求,宏是一种很好的代替函数的方法.   写一个"标准"宏MIN ...

  4. 二分图最大匹配(匈牙利算法) UVA 670 The dog task

    题目传送门 /* 题意:bob按照指定顺序行走,他的狗可以在他到达下一个点之前到一个景点并及时返回,问狗最多能走多少个景点 匈牙利算法:按照狗能否顺利到一个景点分为两个集合,套个模板 */ #incl ...

  5. 240 Search a 2D Matrix II 搜索二维矩阵 II

    编写一个高效的算法来搜索 m x n 矩阵中的一个目标值.该矩阵具有以下特性:    每行的元素从左到右升序排列.    每列的元素从上到下升序排列.例如,考虑下面的矩阵:[  [1,   4,  7 ...

  6. Spring-security配置代码

    @Configuration public static class WebSecurityConfigurer extends WebSecurityConfigurerAdapter{ @Over ...

  7. Hadoop Hive概念学习系列之HiveQL编译基础(十)

    由客户端提交的HiveQL语句将最终被转换为一个或多个MapReduce任务并提交由Hadoop执行.不包含聚合和连接的简单SELECT语句可以使用一个单独的只包含Map阶段的任务实现.使用GROUP ...

  8. 21 调试我们的C#程序

    我们写的C#程序,很多的时候不是能一次就写对的.尤其是在实际的项目中,你经常要做的工作就是不断修改你写的程序,让它正常运行.程序有错误,主要是两种情况.一种是程序报错了,不能正常运行下去.另一种是程序 ...

  9. 专题十一:实现一个基于FTP协议的程序——文件上传下载器

    引言: 在这个专题将为大家揭开下FTP这个协议的面纱,其实学习知识和生活中的例子都是很相通的,就拿这个专题来说,要了解FTP协议然后根据FTP协议实现一个文件下载器,就和和追MM是差不多的过程的,相信 ...

  10. anime.js 实战:实现一个带有描边动画效果的复选框

    在网页或者是APP的开发中,动画运用得当可以起到锦上添花的作用.正确使用动画,不但可以有助于用户理解交互的作用,还可以大大提高网页应用的魅力和使用体验.并且在现在的网页开发中,动画已经成为了一个设计的 ...