当前位置:网站首页>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
边栏推荐
- 「应用架构」六边型架构:三个原则和一个实现示例
- CentOS和Ubantu的Mysql主从配置
- Basic concepts of concurrency, operations, containers
- 07 【动态组件 组件注册】
- Numpy学习
- IDEA中xml文件头报错:URI is not registered (Settings | Languages & Frameworks | Schemas and DTDs)
- 【数据架构】概念数据模型和逻辑数据模型有什么区别
- CSDN 21 Days Learning Challenge - Polymorphism (05)
- 【Software Exam System Architect】System Reliability Analysis and Design ① System Reliability Analysis
- 【Prometheus】Node Exporter常用查询PromQL 语句大总结
猜你喜欢
Excel draws statistical graphs
09 【Attributes继承 provide与inject】
哈希表,哈希桶的实现
"Microservice Architecture" Arrangement and Choreography - Different Models for Making Systems Work Together
支付 x 聚合 x 分账 - 回流平台“二清”风险规避之路
Swin Transformer作者曹越加入智源,开展视觉基础模型研究
JS高级 之 使用 Iterator - Generator
「敏捷建模」纪律:敏捷设计理念
LCD模块如何建立联系分析
Development environment variable record under win
随机推荐
裸辞→自我放松→闭关→复习→斩获Offer
「技术选型」工作流引擎哪家强?首席架构帮你挑
Property animation QPropertyAnimation
【软考 系统架构设计师】系统可靠性分析与设计① 系统可靠性分析
Which is the strongest workflow engine for "Technology Selection"?Chief Architecture Helps You Pick
支付 x 聚合 x 分账 - 回流平台“二清”风险规避之路
"Data Architecture": How can master data management (MDM) help my industry?
Guo Jingjing's personal chess teaching, the good guy is a robot
91.(cesium之家)cesium火箭发射模拟
Lasso regression (Stata)
Controller层代码这么写,简洁又优雅!
jq封装树形下拉选择框组件
SQL中的字符串截取函数
「业务架构」TAGAF建模:业务服务/信息图
Shell functions and arrays
Excel draws statistical graphs
如何理解BIO、NIO、AIO的区别
Plot temperature curves; QChart,
10 【异步组件 组合式函数(hooks)】
CSDN21天学习挑战赛——多态(05)