So easy
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.
Process to the end of file.
1≤n≤100
1≤ai,bi≤1000000000
#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的更多相关文章
- 【转】Windows下使用libsvm中的grid.py和easy.py进行参数调优
libsvm中有进行参数调优的工具grid.py和easy.py可以使用,这些工具可以帮助我们选择更好的参数,减少自己参数选优带来的烦扰. 所需工具:libsvm.gnuplot 本机环境:Windo ...
- Struts2 easy UI插件
一.easy UI是类似于jQuery UI的插件库,它提供了丰富的各种常用插件:tree.datagrid... tree插件: 语法:$(selector).tree([settings]); 常 ...
- Easy UI常用插件使用
一.easy UI是类似于jQuery UI的插件库,它提供了丰富的各种常用插件:tree.datagrid... tree插件: 语法:$(selector).tree([settings]); 常 ...
- UVA-11991 Easy Problem from Rujia Liu?
Problem E Easy Problem from Rujia Liu? Though Rujia Liu usually sets hard problems for contests (for ...
- 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 ...
- easy ui插件
简介: easy UI是类似于jQuery UI的插件库 注意:多脚本同时使用时,注意脚本冲突问题. 常用插件: 1.tree插件(tree插件实现动态树形菜单) 2.datagrid插件(datag ...
- 用TPP开启TDD的easy模式
Test-Drived Development 测试驱动开发三步曲:写一个失败的测试用例->编写生产代码通过这个测试用例(transformation)->重构(refactor).重构是 ...
- Easy Sysprep更新日志-skyfree大神
Easy Sysprep更新日志: Skyfree 发表于 2016-1-22 13:55:55 https://www.itsk.com/forum.php?mod=viewthread&t ...
- [官方软件] 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 ...
- [原创] Easy SysLite V1.2 (2016.5.29更新,新增加WIN10支持,一个程序适配所有系统减肥)
[原创] Easy SysLite V1.2 (2016.5.29更新,新增加WIN10支持,一个程序适配所有系统减肥) nohacks 发表于 2016-5-29 17:12:51 https:// ...
随机推荐
- Sql 主键设置
1.开发数据库时常用命名规范 1>.使用不包含数字的单数表名,如果必要的话可以增加模块名前缀. 2>.对于主键的命名,使用表名+ID的形式. 3>.作为外键的列的名字应该与它们所对应 ...
- composer查看安装情况
composer install --no-progress --profile -vvv
- K Seq HihoCoder - 1046 || BZOJ4504 k个串
这题与超级钢琴类似,然而重复的不重复计算贡献.. 那么先求出数组nxt,nxt[i]表示第i个元素之后的第一个与其相等的元素的下标,不存在则nxt[i]=0 考虑取的区间左端点为1时的情况. 将读入序 ...
- ACM_区间调度问题(贪心)
Meetings 系列一 Time Limit: 2000/1000ms (Java/Others) Problem Description: 多年之后的广财ACM编协如日中天,下系多个部门,且编协成 ...
- Enumerable.Union<TSource> 方法
功能:生成两个序列的并集(使用默认的相等比较器). 命名空间: System.Linq 程序集: System.Core.dll 备注:实现此方法时使用了延迟执行. 它直接返回一个对象,该对象存储了执 ...
- mysql 更改字符集
Windows: 安装目录下新建my.ini文件,输入一下内容 [mysqld]#修改服务器端默认字符编码格式为utf8character-set-server = utf8 [client]#修改客 ...
- Pycharm消除波浪线
PyCharm使用了较为严格的PEP8检查规则,稍微有点错误就会出现波浪线提示.那么怎么消除这些波浪线呢?一个简单粗暴的方法就是:在编辑器的右下角有个小人形状的按钮,点开之后有个滚动条,将滚动条滑动到 ...
- 重构27-Remove God Classes(去掉神类)
在传统的代码库中,我们常常会看到一些违反了SRP原则的类.这些类通常以Utils或Manager结尾,有时也没有这么明显的特征而仅仅是普通的包含多个功能的类.这种God类还有一个特征,使用语句或注释将 ...
- apache启动失败提示预期<IfModule>结果<IfModule>>
经过反复查看httpd.conf文件,发现原因是启动了两遍<IfModule>,也就是出现内容重复标签重复曾经遇到类似的情况Apache2: Expected </> but ...
- Markdown(github)语法
<< 访问 Wow!Ubuntu NOTE: This is Simplelified Chinese Edition Document of Markdown Syntax. If yo ...