JavaScript 백준 온라인 알고리즘 공부
백준 10871 번 JavaScript 문제
const fs = require("fs");
const [input, arr] = (process.platform === "linux"
? fs.readFileSync("/dev/stdin").toString()
: `10 5
1 10 4 9 2 3 8 5 7 6
`
)
.trim()
.split("\n");
numberN = parseInt(input.split(" ")[0]);
numberX = parseInt(input.split(" ")[1]);
arrA = arr.split(" ");
answer = "";
for (let i = 0; i < numberN; i++) {
if (arrA[i] < numberX) {
outputNum = arrA[i];
answer += `${outputNum}` + " ";
}
}
console.log(answer);