File tree 2 files changed +17
-1
lines changed
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change
1
+ // Solution 1
2
+ function solution ( nums ) {
3
+ const oddNums = nums . filter ( ( num ) => num % 2 !== 0 ) ;
4
+
5
+ if ( oddNums . length > 0 ) {
6
+ return oddNums . reduce ( ( acc , cur ) => acc * cur , 1 ) ;
7
+ }
8
+
9
+ return nums . reduce ( ( acc , cur ) => acc * cur , 1 ) ;
10
+ }
11
+
12
+ const fs = require ( 'fs' ) ;
13
+ const input = fs . readFileSync ( '/dev/stdin' ) . toString ( ) . trim ( ) ;
14
+ const nums = input . split ( ' ' ) . map ( ( num ) => Number ( num ) ) ;
15
+
16
+ console . log ( solution ( nums ) ) ;
Original file line number Diff line number Diff line change 111
111
| 주차 | 난이도 | 문제 | JS 풀이 코드 |
112
112
| :--------------------------: | :--------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
113
113
| 1주차<br />(05.01. ~ 05.08.) | ` Bronze 4 ` <br />` Bronze 2 ` <br />` Bronze 3 ` <br />` Bronze 2 ` | [ 윤년] ( https://www.acmicpc.net/problem/2753 ) <br />[ !밀비 급일] ( https://www.acmicpc.net/problem/2753 ) <br />[ 공약수] ( https://www.acmicpc.net/problem/5618 ) <br />[ 진법 변환] ( https://www.acmicpc.net/problem/2745 ) | [ JS] ( https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Bronze/BOJ2753.js ) <br />[ JS] ( https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Bronze/BOJ11365.js ) <br />[ JS] ( https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Bronze/BOJ5618.js ) <br />[ JS] ( https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Bronze/BOJ2747.js ) |
114
- | 2주차<br />(05.09. ~ 05.15.) | ` Bronze 2 ` | [ 알파벳 개수] ( https://www.acmicpc.net/problem/10808 ) | [ JS] ( https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Bronze/BOJ10808.js ) |
114
+ | 2주차<br />(05.09. ~ 05.15.) | ` Bronze 2 ` < br /> ` Bronze 3 ` | [ 알파벳 개수] ( https://www.acmicpc.net/problem/10808 ) < br /> [ 홀짝 칵테일 ] ( https://www.acmicpc.net/problem/21312 ) | [ JS] ( https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Bronze/BOJ10808.js ) < br /> [ JS ] ( https://github.com/JeongHwan-dev/Algorithm-solving-with-js/blob/master/Bronze/BOJ21312.js ) |
115
115
| 3주차<br />(05.16. ~ 05.22.) | - | - | - |
116
116
| 4주차<br />(05.23. ~ 05.29.) | - | - | - |
117
117
| 5주차<br />(05.30. ~ 05.31.) | - | - | - |
You can’t perform that action at this time.
0 commit comments