/평균은 넘겠지.swift Secret
Created
December 27, 2022 16:03
평균은 넘겠지
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
func solution() { | |
let input = readLine()!.split(separator: " ").map { Double($0)! } | |
let n = input.first! | |
let average = input[1...].reduce(0, +) / n | |
let answer = Double(input[1...].filter { $0 > average }.count) / n * 100 | |
print(String(format: "%.3f", answer) + "%") | |
} | |
let c = Int(readLine()!)! | |
(1...c).forEach { _ in solution() } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment