★ 2750 수 정렬하기 ★
//1436
#include <iostream>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int N;
cin >> N;
vector<int> arr{};
while(N--){
int x;
cin >> x;
arr.push_back(x);
}
sort(arr.begin(),arr.end());
for(int x=0;x<arr.size();x++){
cout << arr[x] << '\n';
}
return 0;
}
👯♂️ vector<int> arr{}로 가변 배열 만들고 push_back()으로 업데이트. 이후 sort(arr.begin(), arr.end()) 진행 뒤, 출력
'C, C++ > 🥉 BOJ' 카테고리의 다른 글
(C++)★Math & Geometry Upper-Beginner I - 1 Solved★ (0) | 2024.11.14 |
---|---|
(C++) ★Number Theory Upper-Beginner I - 3 Solved★ (0) | 2024.11.14 |
(C++) ★Implementation Upper-Beginner I - 8 Solved★ (0) | 2024.11.13 |
(C++) ★Implementation Beginner I - 28 Solved★ (0) | 2024.11.13 |
(C++) ★Basics I - 16 Solved★ (0) | 2024.11.13 |
댓글