Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 098db01

Browse files
2016년 - 솔루션 추가
1 parent 5150e02 commit 098db01

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

‎level-1/2016년.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,20 @@ function solution(a, b) {
1111
answer = day[(count + 4) % 7]
1212

1313
return answer;
14-
}
14+
}
15+
16+
//정답 2 - yongchanson
17+
function solution(a, b) {
18+
const month = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
19+
const week = ["THU", "FRI", "SAT", "SUN", "MON", "TUE", "WED"];
20+
21+
let sum = b;
22+
for (
23+
let i = 0;
24+
i < a - 1;
25+
i++ //ex)5월인 경우 1~4월까지 더해준다.
26+
)
27+
sum += month[i];
28+
29+
return week[sum % 7]; //1일이 금요일이므로, 0이면 목요일이 출력되어야 한다.
30+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /