console.log("Hello World!");
console.log("강한친구 대한육군");
console.log("강한친구 대한육군");
console.log(`\\ /\\`);
console.log(` ) ( ')`);
console.log(`( / )`);
console.log(` \\(__)|`);
console.log(`|\\_/|`);
console.log(`|q p| /}`);
console.log(`( 0 )"""\\`);
console.log(`|"^"\` |`);
console.log(`||_/=\\\\__|`);
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let input;
let output;
rl.on("line", line => {
input = line.split(" ");
output = input.reduce((prev, curr) => prev + +curr, 0);
rl.close();
}).on("close", () => {
console.log(output);
process.exit();
});
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let input;
let output;
rl.on("line", line => {
input = line.split(" ");
output = +input[0] - +input[1];
rl.close();
}).on("close", () => {
console.log(output);
process.exit();
});
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let input;
let output;
rl.on("line", line => {
input = line.split(" ");
output = input.reduce((prev, curr) => prev * curr, 1);
rl.close();
}).on("close", () => {
console.log(output);
process.exit();
});
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let input;
let output;
rl.on("line", line => {
input = line.split(" ");
output = input[0] / input[1];
rl.close();
}).on("close", () => {
console.log(output);
process.exit();
});
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let input;
const output = [];
rl.on("line", line => {
input = line.split(" ");
input = input.map(v => +v);
output.push(input[0] + input[1]);
output.push(input[0] - input[1]);
output.push(input[0] * input[1]);
output.push(Math.floor(input[0] / input[1]));
output.push(input[0] % input[1]);
rl.close();
}).on("close", () => {
output.forEach(v => console.log(v));
process.exit();
});
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let input;
const output = [];
rl.on("line", line => {
input = line.split(" ");
input = input.map(v => +v);
output.push((input[0] + input[1]) % input[2]);
output.push(((input[0] % input[2]) + (input[1] % input[2])) % input[2]);
output.push((input[0] * input[1]) % input[2]);
output.push(((input[0] % input[2]) * (input[1] % input[2])) % input[2]);
rl.close();
}).on("close", () => {
output.forEach(v => console.log(v));
process.exit();
});
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
const input = [];
const output = [];
let tempArray;
rl.on("line", line => {
input.push(line);
}).on("close", () => {
tempArray = input[1].split("").reverse();
tempArray.forEach(v => output.push(input[0] * v));
output.forEach(v => console.log(v));
console.log(
output.reduce((prev, curr, index) => {
switch (index) {
case 0:
return curr * 1 + prev;
case 1:
return curr * 10 + prev;
case 2:
return curr * 100 + prev;
}
}),
);
process.exit();
});
마무리
입력받기
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let input;
rl.on("line", line => {
input = line;
rl.close();
input.push(line);
}).on("close", () => {
console.log(input);
process.exit();
});