https://www.acmicpc.net/problem/2750
2750번: 수 정렬하기
첫째 줄에 수의 개수 N(1 ≤ N ≤ 1,000)이 주어진다. 둘째 줄부터 N개의 줄에는 수가 주어진다. 이 수는 절댓값이 1,000보다 작거나 같은 정수이다. 수는 중복되지 않는다.
www.acmicpc.net
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
vector<int> iArr;
int iNum = 0;
cin >> iNum;
iArr.reserve(iNum);
for(int i = 0; i < iNum; i++)
{
int iNumber = 0;
cin >> iNumber;
iArr.push_back(iNumber);
}
sort(iArr.begin(), iArr.end());
for(int i = 0; i < iNum; i++)
cout << iArr[i] << endl;
return 0;
}
알고리즘 안쓰고 다시 풀어봐야겟당;;
'프로그래밍 > 코딩테스트' 카테고리의 다른 글
[백준] 24262번 (0) | 2023.07.20 |
---|---|
[백준] 2587 대표값2 (0) | 2023.07.10 |
[백준] 3052 나머지 (0) | 2023.07.05 |
[프로그래머스] 같은 숫자는 싫어 (0) | 2023.06.22 |
[프로그래머스] 1레벨 문제 (0) | 2023.06.21 |
댓글