文章

33

粉丝

0

获赞

149

访问

5.0k

头像
链表合并 题解:依旧好用的C++
P1025 贵州大学机试题
发布于2026年3月19日 08:56
阅读数 187

#include<bits/stdc++.h>

using namespace std;

int main(){
	
	list<int> lst;//可以用vector 然后sort(lst.begin(),lst.end()),模拟一下
	int s1,s2;
	cin>>s1;
	while(s1--){
		int temp;
		cin>>temp;
		lst.push_back(temp);
	}
	cin>>s2;
	while(s2--){
		int temp;
		cin>>temp;
		lst.push_back(temp);
	}
	lst.sort();
	
	for(auto i:lst) cout<<i<<" ";
	
	return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发