준코딩

[Swift] 백준 2751번 문제 수 정렬하기 2 본문

알고리즘/Swift 백준 문제풀이

[Swift] 백준 2751번 문제 수 정렬하기 2

Ljunhyeob - App Dev 2023. 1. 7. 15:25

https://www.acmicpc.net/problem/2751

 

2751번: 수 정렬하기 2

첫째 줄에 수의 개수 N(1 ≤ N ≤ 1,000,000)이 주어진다. 둘째 줄부터 N개의 줄에는 수가 주어진다. 이 수는 절댓값이 1,000,000보다 작거나 같은 정수이다. 수는 중복되지 않는다.

www.acmicpc.net

https://github.com/Ljunhyeob/baekjoon2751

 

GitHub - Ljunhyeob/baekjoon2751: 백준 - 2751

백준 - 2751. Contribute to Ljunhyeob/baekjoon2751 development by creating an account on GitHub.

github.com

//
//  main.swift
//  baekjoon2751
//
//  Created by 이준협 on 2023/01/07.
//

import Foundation

var count = Int(readLine()!)!
var arr:[Int] = []

for i in 0..<count {
    var num = Int(readLine()!)!
    arr.append(num)
}
arr.sort()
for i in 0..<arr.count{
    print(arr[i])
}
Comments