forked from ndb796/python-for-coding-test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10.cpp
More file actions
29 lines (22 loc) · 524 Bytes
/
10.cpp
File metadata and controls
29 lines (22 loc) · 524 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> v;
bool compare(int a, int b) {
return a > b;
}
int main(void) {
// N을 입력받기
cin >> n;
// N개의 정수를 입력받아 리스트에 저장
for (int i = 0; i < n; i++) {
int x;
cin >> x;
v.push_back(x);
}
// 기본 정렬 라이브러리를 이용하여 내림차순 정렬 수행
sort(v.begin(), v.end(), compare);
for(int i = 0; i < n; i++) {
cout << v[i] << ' ';
}
}