From ef9bd9aa5ea151ebbdb2d600eca29f5153295453 Mon Sep 17 00:00:00 2001 From: songyc macbook Date: Wed, 4 Feb 2026 21:50:24 +0900 Subject: [PATCH] baekjoon 20260204 --- code_study/Baekjoon/swift/1267.swift | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 code_study/Baekjoon/swift/1267.swift diff --git a/code_study/Baekjoon/swift/1267.swift b/code_study/Baekjoon/swift/1267.swift new file mode 100644 index 0000000..0dd8b8f --- /dev/null +++ b/code_study/Baekjoon/swift/1267.swift @@ -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()