baekjoon 20260204

This commit is contained in:
songyc macbook 2026-02-04 21:50:24 +09:00
parent 3f90e25b13
commit ef9bd9aa5e

View File

@ -0,0 +1,27 @@
func solve() {
guard let _ = readLine(),
let input = readLine(),
let callingTime = input.split(separator: " ").compactMap({Int($0)}) as? [Int]
else { return }
let YS = { ( ( $0 / 30 ) + 1 ) * 10 }
let MS = { ( ( $0 / 60 ) + 1 ) * 15 }
var (YS_price, MS_price) = (0, 0)
for time in callingTime {
YS_price += YS(time)
MS_price += MS(time)
}
if YS_price < MS_price {
print("Y", YS_price)
}
else if YS_price > MS_price {
print("M", MS_price)
}
else {
print("Y M", YS_price)
}
}
solve()