๐ฅ Algorithm/Baekjoon
[๋ฐฑ์ค 1789๋ฒ] ์๋ค์ ํฉ - ์๋ฐ์คํฌ๋ฆฝํธ(nodejs)
Lennon
2022. 3. 14. 21:19
728x90
๋ฐ์ํ
https://www.acmicpc.net/problem/1789
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let input;
rl.on('line', function (line) {
input = +line;
rl.close();
}).on('close', function () {
let count = 0;
let i = 1;
while (count <= input) {
count += i;
i++;
}
console.log(i - 2);
});
๊ทธ๋ฆฌ๋๋ผ ์๊ฐํ๊ธฐ ๋๋ฆ๋๋ก ํ ์ ์์ ๊ฒ ๊ฐ๋ค.
๊ทธ๋ฅ ๋ฌธ์ ๋ง ๋ณด๋ฉด ์ด๋ป๊ฒ ํ์ด์ผํ ์ง ๋ง๋งํ ์ ์์ง๋ง, ์๊ฐํด๋ณด๋ฉด ์์ฒญ ๊ฐ๋จํ๊ฒ ํ ์ ์๋ ๋ฌธ์ ์ด๋ค.
728x90
๋ฐ์ํ