백준 - 4344 평균은 넘겠지

AekT·2021년 10월 25일
0

단계별로풀어보기

목록 보기
10/11
post-thumbnail

백준 4344 평균은 넘겠지

문제 : https://www.acmicpc.net/problem/4344

Swift :

import Foundation

let t = Int(readLine()!)!
var res = ""
for _ in 0..<t{
    var score = readLine()!.split(separator: " ").map{Int($0)!}
    score.removeFirst()
    let ave = score.reduce(0, +) / score.count
    let high = score.filter{ $0 > ave}
    res += "\(String(format: "%.3f", round(Double(high.count)/Double(score.count)*100000)/1000))%\n"
}
print(res)
profile
으악

0개의 댓글