当前位置:网站首页>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
边栏推荐
- Explanation of redis database (IV) master-slave replication, sentinel and cluster
- Go language, condition, loop, function
- 字符串最后一个单词的长度
- The El tree implementation only displays a certain level of check boxes and selects radio
- 时序模型:门控循环单元网络(GRU)
- 移动app测试如何进行?
- 为啥禁用外键约束
- Today's sleep quality record 76 points
- 通过 PDO ODBC 将 PHP 连接到 MSSQL
- 单体架构系统重新架构
猜你喜欢
Neodynamic Barcode Professional for WPF V11. 0
Advantages, disadvantages and selection of activation function
幂等性的处理
G007-hwy-cc-estor-03 Huawei Dorado V6 storage simulator construction
Modèle de Cluster MySQL et scénario d'application
Neodynamic Barcode Professional for WPF V11.0
[AI weekly] NVIDIA designs chips with AI; The imperfect transformer needs to overcome the theoretical defect of self attention
贫困的无网地区怎么有钱建设网络?
移动金融(自用)
MetaLife与ESTV建立战略合作伙伴关系并任命其首席执行官Eric Yoon为顾问
随机推荐
PHP 的运算符
移动app测试如何进行?
Single architecture system re architecture
MySQL Cluster Mode and application scenario
软件性能测试报告起着什么作用?第三方测试报告如何收费?
APISIX jwt-auth 插件存在错误响应中泄露信息的风险公告(CVE-2022-29266)
Accumulation of applet knowledge points
Modèle de Cluster MySQL et scénario d'application
多级缓存使用
CAP定理
Load Balancer
使用 Bitnami PostgreSQL Docker 镜像快速设置流复制集群
字符串最后一个单词的长度
What is CNAs certification? What are the software evaluation centers recognized by CNAs?
CVPR 2022 quality paper sharing
什么是CNAS认证?CNAS认可的软件测评中心有哪些?
Go语言条件,循环,函数
Upgrade MySQL 5.1 to 5.68
编译,连接 -- 笔记
Codejock Suite Pro v20. three