https://programmers.co.kr/learn/courses/30/lessons/12901
<2016๋ >
โ ์ฒ์ ํผ ํ์ด(์์ ๋ชปํ์ด์ ์์ด๋์ด๋ณด๊ณ ๋ค์ํ)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
class Solution {
public String solution(int a, int b) {
String answer = "";
int[] month={31,29,31,30,31,30,31,31,30,31,30,31};
int totDate=0;
for(int i=0; i<a-1; i++)
totDate+=month[i];
totDate+=b;
switch(totDate%7){
case 1:answer+="FRI";break;
case 2:answer+="SAT";break;
case 3:answer+="SUN";break;
case 4:answer+="MON";break;
case 5:answer+="TUE";break;
case 6:answer+="WED";break;
case 0:answer+="THU";break;
}
return answer;
}
}
|
cs |