Algorithm/BOJ
[알고리즘/백준/1158] 요세푸스 문제
문제 https://www.acmicpc.net/problem/1158 1158번: 요세푸스 문제 첫째 줄에 N과 K가 빈 칸을 사이에 두고 순서대로 주어진다. (1 ≤ K ≤ N ≤ 5,000) www.acmicpc.net 풀이 let fs = require("fs"); const filePath = process.platform === "linux" ? "/dev/stdin" : "./input.txt"; const [N, K] = fs.readFileSync(filePath).toString().split(" ").map(Number); const people = Array.from({ length: N }, (val, idx) => idx + 1); const answer = []; let idx..