当前位置:网站首页>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
边栏推荐
- CatchAdmin实战教程(四)Table组件之自定义基础页面
- Swin Transformer作者曹越加入智源,开展视觉基础模型研究
- 【软考 系统架构设计师】系统可靠性分析与设计① 系统可靠性分析
- 「业务架构」TOGAF建模:业务功能分解图
- 【数据仓库】什么是 Azure Synapse,它与 Azure Data Bricks 有何不同?
- vs2012创建WCF应用程序
- VBA: Inputbox Function and Inputbox Method
- CSDN 21 Days Learning Challenge - Polymorphism (05)
- makefile 杂项
- 第三章 搜索与图论(三)
猜你喜欢
随机推荐
【软考 系统架构设计师】案例分析⑥ Web应用系统架构设计
在“企业通讯录”的盲区,融云的边界与分寸
UE4 Sequence添加基础动画效果 (05-蓝图触发Sequence)
细说Redis监控和告警
PostgreSQL 2022 发展现状:13 个非 psql 工具
第三章 搜索与图论(三)
08 【Props 组件事件】
2022年固定资产管理系统的概况
JS高级 之 使用 Iterator - Generator
Which is the strongest workflow engine for "Technology Selection"?Chief Architecture Helps You Pick
解决问题目录
傅立叶级数与傅里叶变换
ESP8266-Arduino编程实例-MQ-8氢气传感器驱动
Fourier series and Fourier transform
Oracle rac所在的网络要割接,停掉其中一个rac节点,这种方案可行吗?
「业务架构」TOGAF建模:组织分解图(组织映射)
UE4 Sequence添加基础动画效果 (04-在序列中使用粒子效果)
【数据仓库】什么是 Azure Synapse,它与 Azure Data Bricks 有何不同?
支付 x 聚合 x 分账 - 回流平台“二清”风险规避之路
【物联网架构】什么是物联网平台?