-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
14 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# COTE | ||
||문제종류|문제명|응시 날짜|채점 결과|재응시예정| | ||
|:-:|:-|:-:|:---:|:---:|:-:| | ||
|1|[그리디](./greedy/)|[예제](./greedy/greedy_ex.js)<br>[연습1](./greedy/greedy_01.js)<br>[연습2](./greedy/greedy_02.js)<br>[연습3](./greedy/greedy_03.js)<br>-<br>[실전1](./greedy/test_01.js)|22.07.14|O<br>X<br>O<br>O<br>-<br>O|X<br>[다시 풀었고 맞았음](./greedy/replay_01.js)<br>X<br>X<br>-<br>O| | ||
|1|[그리디](./greedy/)|[예제](./greedy/greedy_ex.js)<br>[연습1](./greedy/greedy_01.js)<br>[연습2](./greedy/greedy_02.js)<br>[연습3](./greedy/greedy_03.js)<br>-<br>[실전1](./greedy/test_01.js)<br>[실전2](./greedy/test_02.js)<br>|22.07.14|O<br>X<br>O<br>O<br>-<br>O<br>O<br>|X<br>[다시 풀었고 맞았음](./greedy/replay_01.js)<br>X<br>X<br>-<br>O<br>X<br>| | ||
|2|[구현](./implementation/)|[예제1](./implementation/imple_ex01.js)<br>[예제2](./implementation/imple_ex02.js)<br>[연습1](./implementation/imple_01.js)<br>[연습2](./implementation/imple_02.js)|22.07.15|△<br>△<br>△<br>X|O<br>O<br>O<br>O| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); |