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. centos 安装sysbench

    安装sysbench 下载并且解压 shell> wget https://github.com/akopytov/sysbench/archive/1.0.zip -O "sysbe ...

  2. NLog简单配置与使用

    对项目添加NLog 安装完成后,在项目里面会自动引入该引入的dll,并且会添加如下两个文件 NLog的配置主要是在这个config文件里.当然也可以将这个文件里面的nlog节点复制到项目配置文件App ...

  3. UC浏览器中,设置了position: fixed 的元素会遮挡z-index值更高的同辈元素

    "UC浏览器中,设置了position: fixed 的元素会遮挡z-index值更高的同辈元素(非fixed)." 我们使用的artDialog弹窗中,在UC浏览器中,如果页面高 ...

  4. Winform学习知识汇总

    引用博客 http://www.cnblogs.com/peterzb/archive/2009/06/14/1502918.html

  5. Spark性能优化指南-高级篇(spark shuffle)

    Spark性能优化指南-高级篇(spark shuffle) 非常好的讲解

  6. 专题七:UDP编程补充——UDP广播程序的实现

    一.程序实现 UDP广播程序的实现代码: using System; using System.Net; using System.Net.Sockets; using System.Text; us ...

  7. <mybatis:scan>与<MapperScannerConfigurer/>

    使用Mybatis作为持久层的框架,对dao层的bean对象的注解扫描有两种方式:<mybatis:san>.<MapperScannerConfigurer> 一:<m ...

  8. C#基础知识面试经典[整理]

    个人网站:http://www.51pansou.com .net视频下载:.net视频教程 .net源码下载:.net源码 当初学 C# 时是找个人大概问了一下数据类型和分支语句就开始做项目了.这两 ...

  9. Understanding and Analyzing Application Crash Reports

    Introduction When an application crashes, a crash report is created and stored on the device. Crash ...

  10. Beta冲刺提交-星期四

    这个作业属于哪个课程 软件工程 这个作业要求在哪里 <作业要求的链接> 团队名称 唱跳RAP编程 这个作业的目标 1.进行每日例会,每个成员汇报自己今天完成     的工作,PM安排明天的 ...