오락기/codeWar

백준 1924 2007년

문방구앞오락기 2018. 5. 25. 11:33

오늘은 2007년 1월 1일 월요일이다. 그렇다면 2007년 x월 y일은 무슨 요일일까? 이를 알아내는 프로그램을 작성하시오.



첫째 줄에 x월 y일이 무슨 요일인지에 따라 SUN, MON, TUE, WED, THU, FRI, SAT중 하나를 출력한다.


1 1



MON

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
29
30
31
32
33
34
35
36
import java.util.*;
 
public class Main{
 
    public static void main(String args[]){
        
        int[] cal =        { 31,  28  ,31 , 30 , 31,    30,  31,  31,  30,  31,  30,  31} ;
        String[] cal2 = { "SUN"  , "MON""TUE""WED""THU""FRI""SAT" };
        
        Scanner sc = new Scanner(System.in);
        
        int t = 0;
        int m = sc.nextInt();
        int d = sc.nextInt();
        
        
        
        for(int i = 0 ; i< m-1 ; i++){
                        
            t +=cal[i];
//            System.out.println(cal[i]);
            
        }
//        System.out.println(t);
//        System.out.println(d);
//        System.out.println();
        t=t+d;
        t=t%7;
        
//        System.out.println(t);
        System.out.println(cal2[t]);
        
    
 
    }
}