Skip to content

Commit a600ced

Browse files
author
Eric
committed
86차 2번 문제풀이(푸는중)
1 parent b5604cc commit a600ced

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

live8/test86/문제2/황장현.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const input = require('fs')
2+
.readFileSync(process.platform === 'linux' ? '/dev/stdin' : './input.txt')
3+
.toString()
4+
.trim()
5+
.split('\n')
6+
.map((el) => el.split(' ').map(Number));
7+
8+
function solution(input) {
9+
const N = input[0][0];
10+
const 지방예산요청 = input[1].sort((a, b) => a - b);
11+
const M = input[2][0];
12+
13+
let high = 지방예산요청[N - 1];
14+
let low = 0;
15+
16+
while (low <= high) {
17+
const mid = Math.floor((low + high) / 2);
18+
const sum = 지방예산요청.reduce((acc, v) => acc + (v <= mid ? v : mid), 0);
19+
}
20+
}
21+
22+
console.log(solution(input));

0 commit comments

Comments
 (0)