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. 理解 Java 构造函数不可以继承

    参考来源:http://www.52bowen.com/a/2604620.html

  2. virtualwrapper使用

    1.创建: mkvirtualenv 虚拟环境目录 2.查看虚拟环境 workon lsvirtualenv 3.进入虚拟环境 workon 虚拟环境目录 4.退出虚拟环境 deactivate 5. ...

  3. redis 配置多个ip 解决方案

    因为在 redis 中bind 指定的ip 其实为同一网段或localhost 监听ip,在这里配置 内网其他网段或者外网多个ip 后  重启 redis 是不会成功的, 这边建议使用 折中方案,开通 ...

  4. IFormattable,ICustomFormatter, IFormatProvider接口

    定                 义 1.IFormattable   提供一种功能,用以将对象的值格式化为字符串表示形式. 2.IFormatProvider  提供用于检索控制格式化的对象的机制 ...

  5. redis 数据类型Hash

    redis的Hash数据类型: hash数据类型 Redis hash 是一个string类型的field和value的映射表,hash特别适合用于存储对象. 创建map: hmset map c & ...

  6. http链接中请求进行编码,Http请求

    如果参数中含有特殊字符&,则强制URL编码<br> http协议中参数的传输是"key=value"这种简直对形式的,如果要传多个参数就需要用“&”符号 ...

  7. Context Switches msdn

    Context Switches  https://msdn.microsoft.com/en-us/library/ms682105(VS.85).aspx The scheduler mainta ...

  8. 安卓app测试之启动时间和电量监控

    一.启动时间监控 通过adb命令获取 adb shell am start -W /<packageName> /<activityName> 案例: adb shell am ...

  9. c++类简介

    C++类(Class)总结   一.C++类的定义     C++中使用关键字 class 来定义类, 其基本形式如下:class 类名{ public: //行为或属性  protected: // ...

  10. ES 提案的各状态

    JavaScrpit,亦即 ECMAScript,新功能的演进是由一个叫 TC39 这么个组织在统筹协调和推进的. 一般新特性会由社区先提案,被采纳后开始进入下一流程.一个提案到最终落地到成为标准,需 ...