백준 알고리즘 기초 강의에 명시된 문제를 풀이한 포스트입니다
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
const input = [];
rl.on("line", (line) => {
input.push(line);
rl.close();
}).on("close", () => {
const [N, B] = input[0].split(" ").map((v) => +v);
console.log(N.toString(B).toUpperCase());
process.exit();
});
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
const input = [];
rl.on("line", (line) => {
input.push(line);
rl.close();
}).on("close", () => {
const [N, B] = input[0].split(" ");
console.log(parseInt(N, +B).toString(10));
process.exit();
});
문제 이해 못함
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
const input = [];
rl.on("line", (line) => {
input.push(line);
if (+input[0] === input.length - 1) rl.close();
}).on("close", () => {
/**
* [입력]
* A진법, B진법
* M: 입력 숫자의 자리수의 개수
* A진법 숫자 M개 ( 공백 구분 )
*
* [출력]
* A진법 숫자들 ---> B진법 숫자들
*
* 결론: A진법 숫자들 --> 10진법 숫자들 --> B진법 숫자들
*/
process.exit();
});
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
const input = [];
rl.on("line", (line) => {
input.push(line);
rl.close();
}).on("close", () => {
let number = +input[0];
let divideNumber = 2;
const answer = [];
while (number !== 1) {
if (number % divideNumber === 0) {
answer.push(divideNumber);
number = number / divideNumber;
} else {
divideNumber++;
}
}
console.log(answer.join("\n"));
process.exit();
});