알고리즘 풀이/프로그래머스
[프로그래머스][Java] 2016년
배게
2019. 2. 28. 01:11
728x90
숫자조립만 잘해주면됨
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | class Solution { public String solution(int a, int b) { String answer = ""; int[] days = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; String[] dates = {"FRI", "SAT","SUN", "MON", "TUE", "WED", "THU"}; int tot = 0; for (int i = 0; i < a - 1; i++) { tot += days[i]; } tot += (b-1); tot %= 7; tot += 1; System.out.println(tot); answer = dates[tot-1]; return answer; } } |