알고리즘/백준 알고리즘
[java] 백준 알고리즘 1924번 2007년 풀이소스
희랍인 조르바
2018. 5. 16. 11:43
* 풀이소스
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | public class Baekjoon1924{ public static void main(String[] args){ Scanner scanner = new Scanner(System.in); int m; int d; int sum=0; m= scanner.nextInt(); d= scanner.nextInt(); int[] month = new int[13]; month[1]=month[3]=month[5]=month[7]=month[8]=month[10]=31; month[4]=month[6]=month[9]=month[11]=30; month[2]=28; for(int i=1; i<=12; i++){ if(m==i){ break; } sum = sum+month[i]; } sum= sum+d; switch(sum%7){ case 0: System.out.println("SUN"); break; case 1: System.out.println("MON"); break; case 2: System.out.println("TUE"); break; case 3: System.out.println("WED"); break; case 4: System.out.println("THU"); break; case 5: System.out.println("FRI"); break; case 6: System.out.println("SAT"); break; } } } | cs |