diff --git a/src/cote/README.md b/src/cote/README.md index 2d2e5113..6e7a0b1c 100644 --- a/src/cote/README.md +++ b/src/cote/README.md @@ -1,5 +1,5 @@ # COTE ||문제종류|문제명|응시 날짜|채점 결과|재응시예정| |:-:|:-|:-:|:---:|:---:|:-:| -|1|[그리디](./greedy/)|[예제](./greedy/greedy_ex.js)
[연습1](./greedy/greedy_01.js)
[연습2](./greedy/greedy_02.js)
[연습3](./greedy/greedy_03.js)
-
[실전1](./greedy/test_01.js)|22.07.14|O
X
O
O
-
O|X
[다시 풀었고 맞았음](./greedy/replay_01.js)
X
X
-
O| +|1|[그리디](./greedy/)|[예제](./greedy/greedy_ex.js)
[연습1](./greedy/greedy_01.js)
[연습2](./greedy/greedy_02.js)
[연습3](./greedy/greedy_03.js)
-
[실전1](./greedy/test_01.js)
[실전2](./greedy/test_02.js)
|22.07.14|O
X
O
O
-
O
O
|X
[다시 풀었고 맞았음](./greedy/replay_01.js)
X
X
-
O
X
| |2|[구현](./implementation/)|[예제1](./implementation/imple_ex01.js)
[예제2](./implementation/imple_ex02.js)
[연습1](./implementation/imple_01.js)
[연습2](./implementation/imple_02.js)|22.07.15|△


X|O
O
O
O| \ No newline at end of file diff --git a/src/cote/greedy/test_02.js b/src/cote/greedy/test_02.js new file mode 100644 index 00000000..85ae638b --- /dev/null +++ b/src/cote/greedy/test_02.js @@ -0,0 +1,13 @@ +'use strict'; + +function solution(s) { + let acc = s[0]*1; + for(let i = 1; i < s.length; i++) { + if(s[i] === '0' || acc === 0) acc += (s[i])*1; + else acc *= s[i]; + } + return acc; +} + +const s = '20984'; +console.log(solution(s)); \ No newline at end of file