import Foundation let repeatCount = Int(readLine()!)! for _ in 1...repeatCount { // 값을 받아온다 var scoreArr = readLine()!.split(separator: " ").map{ Double($0)! } let scoreCount = scoreArr[0] scoreArr.remove(at: 0) // 평균을 계산한다 let average = scoreArr.reduce(0, +) / scoreCount let upperAverage = scoreArr.filter { $0 > average } let percentage = Double(upperAverage.count) / Double(scoreArr.count) * 10..
let repeatCount = Int(readLine()!)! var scoreStringArr: [Character] = [] for _ in 1...repeatCount { scoreStringArr = Array(readLine()!) var score = 0 var totalScore = 0 for char in scoreStringArr { if char == "O" { score += 1 totalScore += score } else { score = 0 } } print(totalScore) } 규칙만 확실히 이해하면 어렵지 않은 문제다. www.acmicpc.net/problem/8958 8958번: OX퀴즈 "OOXXOXXOOO"와 같은 OX퀴즈의 결과가 있다. O는 문제를 맞은 것이..