알고리즘
[백준 1924][Swift] 2007년
moving
2022. 4. 1. 10:57
728x90
코드
let input = readLine()?.split(separator: " ")
let array = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
let month = Int(input?.first ?? "0")!
var day = Int(input?.last ?? "0")!
for i in 1..<month {
switch i {
case 1, 3, 5, 7, 8, 10, 12:
day += 31
case 4, 6, 9, 11:
day += 30
case 2:
day += 28
default:
break
}
}
print(array[day % 7])
https://www.acmicpc.net/problem/1924