Skip to content

Commit b894947

Browse files
committed
Silver5: 이진수변환
1 parent 3d71bd3 commit b894947

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

Algorithm/DevideConquer/BOJ123

Whitespace-only changes.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const fs = require("fs");
2+
const filePath =
3+
process.platform === "linux" ? "/dev/stdin" : "./Z_Test/input.txt";
4+
let input = fs.readFileSync(filePath).toString().trim().split("\n");
5+
6+
const n = +input[0]
7+
8+
const solution=(n) =>{
9+
10+
console.log([...n.toString(2)].filter((item)=>item==='1').length)
11+
12+
}
13+
14+
solution(n)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
14

0 commit comments

Comments
 (0)