BOJ 문제풀이

백준 11728번 c++ 풀이

koreasunoo 2021. 10. 10. 23:32

전략:

1. 모든 인풋을 벡터에 넣어준다.

2. sort 함수를 이용하여 정렬해준다.

코드:

#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int N, M;
	cin>>N>>M;
	vector<int> a(N+M);
	for(int i= 0; i<N+M; ++i){
		cin>>a[i];
	}
	sort(a.begin(), a.end());
	for(int i= 0; i<N+M;++i){
		cout<<a[i]<<" ";
	}
	cout<<"\n";
	
}

'BOJ 문제풀이' 카테고리의 다른 글

백준 1644번 c++ 풀이  (0) 2021.10.10
백준 2003번 c++ 풀이  (0) 2021.10.10
백준 4673번 c++ 풀이  (0) 2021.10.10
백준 2193번 c++ 풀이  (0) 2021.10.10
백준 2436 c++ 풀이  (0) 2021.10.10