티스토리 뷰

Algorithm/Baekjoon Online Judge

1924번 '2007년'

할루루 2018. 2. 22. 11:45
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
enum Day: Int{
    case SUN = 6
    case MON = 0
    case TUE = 1
    case WED = 2
    case THU = 3
    case FRI = 4
    case SAT = 5
}
let daysOfMonth: [IntInt= [131228331430531630731831930103111301231]
 
let input = readLine()?.split(separator: " ")
let x = Int((input?.first?.description)!)!
let y = Int((input?.last?.description)!)!
var count = 0
for i in 1..<x{
    count += daysOfMonth[i]!
}
count += y
count -= 1
print(Day.init(rawValue: count % 7)!)
 
 
cs



결과값 출력을 위해 열거형을 사용해 보았다.

'Algorithm > Baekjoon Online Judge' 카테고리의 다른 글

1978번 '소수 찾기'  (0) 2018.02.22
1977번 '완전제곱수'  (0) 2018.02.22
1546번 '평균'  (0) 2018.02.22
1316번 '그룹 단어 체커'  (0) 2018.02.22
1193번 '분수찾기'  (0) 2018.02.22
댓글
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
글 보관함