当前位置:网站首页>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 2Sample 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 边栏推荐
- Plot temperature curves; QChart,
- 数据库事务
- Array of shell scripts
- ES复杂操作搜索
- Development environment variable record under win
- CSDN 21 Days Learning Challenge - Polymorphism (05)
- ESP8266-Arduino编程实例-MQ-7一氧化碳传感器驱动
- 【Enterprise Architecture】Agile and Enterprise Architecture: Strategic Alliance
- LeetCode Algorithm 914. 卡牌分组
- WebView2 通过 PuppeteerSharp 实现爬取 王者 壁纸 (案例版)
猜你喜欢
随机推荐
UE4 粒子特效基础学习 (01-将粒子效果挂载到角色身上)
武功修炼:内功
Controller层代码这么写,简洁又优雅!
高通 msm8953 LCD 休眠/唤醒 流程
多元线性回归分析(Stata)
Guo Jingjing's personal chess teaching, the good guy is a robot
LCD DRM驱动框架分析一
JS高级 之 使用 Iterator - Generator
08 【Props 组件事件】
[Metaverse Omi Says] Listen to how Rabbit Fan Rabbit creates a new era of trendy play from virtual to reality
裸辞→自我放松→闭关→复习→斩获Offer
IDEA中xml文件头报错:URI is not registered (Settings | Languages & Frameworks | Schemas and DTDs)
MySQL 执行查询流程
属性动画QPropertyAnimation
gin-gonic/gin使用详解
解决问题目录
「业务架构」TOGAF建模:业务功能分解图
Behind iFLYTEK's translation machine stealing the spotlight, cross-language communication has entered a new era
支付 x 聚合 x 分账 - 回流平台“二清”风险规避之路
09 【Attributes继承 provide与inject】









