Notice
                              
                          
                        
                          
                          
                            Recent Posts
                            
                        
                          
                          
                            Recent Comments
                            
                        
                          
                          
                            Link
                            
                        
                    | 일 | 월 | 화 | 수 | 목 | 금 | 토 | 
|---|---|---|---|---|---|---|
| 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 | 30 | 31 | 
                            Tags
                            
                        
                          
                          - stoi
- 백트래킹
- N과M
- 티스토리챌린지
- 우선순위큐
- 프로그래머스
- priority_queue
- 최소공배수
- 분할정복
- BFS
- 깊이우선탐색
- DP
- 문자열
- map
- 배열
- 알고리즘
- 백준
- 유클리드호제법
- DFS
- C++
- 정렬
- 그래프
- int
- 에라토스테네스의 체
- Sort
- 이분탐색
- 오블완
- 다이나믹프로그래밍
- Set
- vector
                            Archives
                            
                        
                          
                          - Today
- Total
안녕 세상아,
[백준/c++] 2751 수 정렬하기 2 본문
https://www.acmicpc.net/problem/2751
sort 사용하면 됨.
출력할 때 시간초과 대비하여 '\n' 사용ㅎㅐ주면 됨
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin >> n;
	vector<int> v;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		v.push_back(x);
	}
	sort(v.begin(), v.end());
	for (int i = 0; i < v.size(); i++) {
		cout << v[i] << '\n';
	}
}'백준' 카테고리의 다른 글
| [백준/c++] 4673 셀프 넘버 (1) | 2024.12.28 | 
|---|---|
| [백준/c++] 2941 크로아티아 알파벳 (0) | 2024.12.28 | 
| [백준/c++] 1316 그룹 단어 체커 (0) | 2024.12.17 | 
| [백준/c++] 4963 섬의 개수 (0) | 2024.11.16 | 
| [백준/c++] 2178 미로 탐색 (1) | 2024.11.16 |