프로그래머스: 2016년

김아무개·2023년 4월 6일
0

프로그래머스

목록 보기
25/41

내 코드

class Solution {
    public String solution(int a, int b) {
        int[] month = new int[]{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        String[] yoil = new String[]{"FRI", "SAT", "SUN", "MON", "TUE", "WED", "THU"};
        
        int temp = b - 1;
        for (int i = 0; i < a - 1; i++) {
            temp += month[i];
        }
        return yoil[temp % 7];
    }
}
profile
Hello velog! 

0개의 댓글