当前位置:网站首页>ZZULIOJ 1124: Merge two sorted arrays
ZZULIOJ 1124: Merge two sorted arrays
2022-08-10 10:03:00 【An Ran_】
1124: Merge two ordered arrays
span>Time limit: 1 Sec Memory limit: 128 MBTitle descriptionIt is known that there are m elements in ascending order in array a, and n elements in descending order in array b. The programming stores all elements in a and b into array c in descending order.
EnterThe input has two lines, the first line is first a positive integer m, then m integers; the second line is first a positive integer n, then n integers, m, n are both less than or equal to 1000000.
OutputOutput the combined m+n integers, separated by spaces.The output is on one line.
Sample input Copy4 1 2 5 73 6 4 2
Sample output Copy7 6 5 4 2 2 1
#include #include int a[1000000];int b[1000000];int c[2000000];void merge(int*a,int m,int*b,int n);void print(int *c,int cnt);int cmp(const void*p1,const void*p2);//The overall idea is stored in a new array cint main(){int m,n;int i,j;scanf("%d",&m);for(i=0;ib[j]) c[k++]=a[i++];else c[k++]=b[j++];}while(i
边栏推荐
猜你喜欢
随机推荐
【分布式】资源与事务:可观测性的基本二重性
在兄弟连战狼班参加PHP培训做行业领先人才
大连理工&鹏城&UAE提出用于伪装目标检测的混合尺度三重网络ZoomNet,性能SOTA!
vs2012创建WCF应用程序
故障分析 | Sql_slave_skip_counter 使用不规范对复制的影响
「业务架构」TOGAF建模:组织分解图(组织映射)
web项目访问引用jar内部的静态资源
解决问题目录
【API Management】What is API Management and why is it important?
UE4 Sequence添加基础动画效果 (05-蓝图触发Sequence)
2022.8.7-----leetcode.636
win下的开发环境变量记录
jq封装树形下拉选择框组件
俄罗斯宣布临时禁止进口摩尔多瓦植物产品
【Prometheus】Node Exporter常用查询PromQL 语句大总结
Singleton pattern base class
【物联网架构】最适合物联网的开源数据库
中国驻越南使馆提醒在越北部、中部地区中国公民做好台风“木兰”安全防范
腾讯云校园大使开始招募啦,内推名额和奖金等你来拿
细说Redis监控和告警