当前位置:网站首页>Merging of Shanzhai version [i]
Merging of Shanzhai version [i]
2022-04-23 15:44:00 【MC happy bitter little fear】
subject :
Title Description
Problem description
Coco and LeLe have a lot of game cards on hand , There are numbers on the cards , They sort their cards from small to large , Now they want to put their cards together , And also ensure that it is sorted from small to large . Because the number of cards may reach millions , And you have to merge the cards in a second , Now please help !
Input format
There are three lines .
first line : Two integers separated by spaces n and m, Number of cards representing cocoa and LeLe respectively ;
The second line :n An integer separated by a space , Indicates the number of cocoa cards from small to large ;
The third line :m An integer separated by a space , Indicates the number of Lele card from small to large ;
Output format
Just one line :n+m It's an integer , Space off , Indicates the number of the combined card from small to large .
sample input
3 4
3 5 7
1 3 4 6
sample output
1 3 3 4 5 6 7
Data range
n<=1000000,m<=1000000
The time set by the teacher for the beginning of this problem is 2 Sec, Ha ha ha , Violence directly 100 To get :
Definition a[2000010]
Then go straight to various individual sort Violent perfection .
But the teacher saw us operate so N, I changed the time to 1 Sec.
wawawaw, Suddenly tears poured down .
…
shua Code start
Got two “ The pointer ”( It's not here *x The pointer of ).
i,j;
Don't talk much , Code up :
#include <bits/stdc++.h>
using namespace std;
int a[1000010],b[1000010];
int main(){
int n,m;
cin>>n>>m;
for(int i=1;i<=n;i++)scanf("%d",&a[i]);
for(int j=1;j<=m;j++)scanf("%d",&b[j]);
int i=1,j=1;
for(int x=1;x<=n+m;x++){
if(a[i]>b[j])printf("%d ",a[i]),i++;
else printf("%d ",b[j]),j++;
}
return 0;
}
goodbye!!!
Shanzhai version merged 【 Next 】 Portal
版权声明
本文为[MC happy bitter little fear]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231531525307.html
边栏推荐
- 2022年中国数字科技专题分析
- Modèle de Cluster MySQL et scénario d'application
- Go语言切片,范围,集合
- cadence SPB17.4 - Active Class and Subclass
- WPS brand was upgraded to focus on China. The other two domestic software were banned from going abroad with a low profile
- Common types of automated testing framework ▏ automated testing is handed over to software evaluation institutions
- GFS distributed file system (Theory)
- Calculate the number of occurrences of a character
- Multitimer V2 reconstruction version | an infinitely scalable software timer
- Codejock Suite Pro v20. three
猜你喜欢
随机推荐
Explanation of redis database (IV) master-slave replication, sentinel and cluster
How did the computer reinstall the system? The display has no signal
PHP operators
计算某字符出现次数
Common types of automated testing framework ▏ automated testing is handed over to software evaluation institutions
fatal error: torch/extension. h: No such file or directory
Treatment of idempotency
s16.基于镜像仓库一键安装containerd脚本
cadence SPB17. 4 - Active Class and Subclass
Multitimer V2 reconstruction version | an infinitely scalable software timer
c语言---字符串+内存函数
单体架构系统重新架构
负载均衡器
提取不重复的整数
What is CNAs certification? What are the software evaluation centers recognized by CNAs?
为啥禁用外键约束
服务器中毒了怎么办?服务器怎么防止病毒入侵?
MySQL Cluster Mode and application scenario
Go语言切片,范围,集合
腾讯Offer已拿,这99道算法高频面试题别漏了,80%都败在算法上