cgy12306

[백준 BoJ] 11728 - 배열 합치기 본문

Algorithm/C++

[백준 BoJ] 11728 - 배열 합치기

cgy12306 2021. 3. 25. 16:50
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int N, M, num;
	vector<int> v;
	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		cin >> num;
		v.push_back(num);
	}
	for (int i = 0; i < M; i++) {
		cin >> num;
		v.push_back(num);
	}
	sort(v.begin(), v.end());
	for (auto iter = v.begin(); iter != v.end(); ++iter) {
		cout << *iter <<" ";
	}
}

'Algorithm > C++' 카테고리의 다른 글

[백준 BoJ] 10828 - 스택  (0) 2021.03.25
[백준 BoJ] 2748 - 피보나치 수 2  (0) 2021.03.25
[백준 BoJ] 10816 - 숫자 카드 2  (0) 2021.03.25
[백준 BoJ] 10815 - 숫자 카드  (0) 2021.03.25
[백준 BoJ] 1049 - 기타줄  (0) 2021.03.25
Comments