728x90
반응형
11728 배열 합치기
문제 풀이
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void fast_io(void)
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
int a,b;
int main(void)
{
fast_io();
cin >> a >> b;
int c=a+b;
vector<int> v(c);
for(int i=0;i<c;i++)
cin >> v[i];
sort(v.begin(),v.end());
for(auto i=0;i<c;i++)
cout << v[i]<< " ";
}
배열 a,b의 길이를 받은뒤 한번에 값을 넣어놓고 정렬한 뒤 반환했다.
728x90
반응형
'자라는 개발자 > 문제풀이' 카테고리의 다른 글
백준 c++ 15312 이름 궁합 (0) | 2022.08.17 |
---|---|
백준 c++ 19709 LunchBox (0) | 2022.08.16 |
백준 c++ 9933 민균이의 비밀번호 (0) | 2022.08.08 |
백준 c++ 11645 I've Been Everywhere, Man (0) | 2022.07.23 |
백준 c++ 15577 Prosjek (0) | 2022.07.20 |