#include <bits/stdc++.h>

using namespace std;

struct node
{
int data;
struct node *next;
};
struct node *creat(int n)
{
struct node *head,*tail,*p;
head=(struct node*)malloc(sizeof(struct node));
head->next=NULL;
tail=head;
int i;
for(i=0;i<n;i++)
{
p=(struct node*)malloc(sizeof(struct node));
p->next=NULL;
scanf("%d",&p->data);
tail->next=p;
tail=p;
}
return head;
}
int main()
{
struct node *head,*head1,*head2,*p,*p1,*p2,*tail;
head=(struct node*)malloc(sizeof(struct node));
head->next=NULL;
tail=head;
int n,m;
scanf("%d %d",&n,&m);
head1=creat(n);
head2=creat(m);
p1=head1->next;
p2=head2->next;
free(head1);
free(head2);
while(p1&&p2)
{
if(p1->data<p2->data)
{
tail->next=p1;
tail=p1;
p1=p1->next;
tail->next=NULL;
}
else
{
tail->next=p2;
tail=p2;
p2=p2->next;
tail->next=NULL;
}
}
if(p1) tail->next=p1;
else tail->next=p2;
for(p=head->next;p!=NULL;p=p->next)
{
if(p==head->next) printf("%d",p->data);
else printf(" %d",p->data);
}
return 0; }

最新文章

  1. cf Round 613
  2. Python学习笔记(三)——类型与变量
  3. 理解innodb buffer pool
  4. fork Bomb
  5. PostgreSQL Replication之第十二章 与Postgres-XC一起工作(3)
  6. Edit Distance编辑距离(NM tag)- sam/bam格式解读进阶
  7. Linux常用文件管理命令
  8. Sciter/HTMLayout内存占用评测
  9. 整理:Google jQuery 引用地址大全和方法(转)
  10. 转:MongoDB调查总结
  11. SQL从入门到基础 - 05 数据分组、Having语句
  12. HDU 3478 Play with Chain (Splay树)
  13. 关于sqlserver还原不了数据库的原因
  14. China-global view
  15. 键盘控制div移动并且解决停顿问题(原生js)
  16. Oracle 11g常用管理命令(用户、表空间、权限)
  17. Redis之数据类型大全
  18. TeamWork#3,Week5,Scrum Meeting 11.13
  19. Protobuf底层存储原理
  20. 【Oracle123】向OracleDB导入*.csv文件数据

热门文章

  1. 【Python基础】04_Python中的if判断语句
  2. NopCommerce的autofac的理解
  3. 记录RabbitMQ
  4. Django多对多
  5. html-proload
  6. 微信小程序登录获取手机号
  7. 如何在调用Marketing Cloud contact创建API时增加对扩展字段的支持
  8. 12.JDBC
  9. 第三章、drf框架 - 序列化组件 | Serializer
  10. LintCode上的一道算法面试题: 数字的统计