2557번: Hello World
console.log("Hello World!");
10718번: We love krill
console.log("강한친구 대한육군");
console.log("강한친구 대한육군");
10171번: 고양이
console.log("\\ /\\");
console.log(" ) ( ')");
console.log("( / )");
console.log(" \\(__)|");
10172번: 개
console.log("|\\_/|");
console.log("|q p| /}");
console.log("( 0 )\"\"\"\\");
console.log("|\"^\"` |");
console.log("||_/=\\\\__|");
1000번: A+B
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
let array = [];
let answer = 0;
const onInput = (input) => {
array = input.split(' ');
for(a of array) {
answer += Number(a);
}
console.log(answer);
rl.close();
}
rl.on('line', onInput);
1001번: A-B
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
let array = [];
const onInput = (input) => {
array = input.split(' ');
answer = Number(array[0]) - Number(array[1]);
console.log(answer);
rl.close();
}
rl.on('line', onInput);
10998번: AXB
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
let array = [];
const onInput = (input) => {
array = input.split(' ');
answer = Number(array[0]) * Number(array[1]);
console.log(answer);
rl.close();
}
rl.on('line', onInput);
1008번: A/B
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
let array = [];
const onInput = (input) => {
array = input.split(' ');
answer = Number(array[0]) / Number(array[1]);
console.log(answer);
rl.close();
}
rl.on('line', onInput);
10869번: 사칙연산
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
const onInput = (input) => {
const [num1, num2] = input.split(' ');
const sum = Number(num1) + Number(num2);
const minus = Number(num1) - Number(num2);
const multiplication = Number(num1) * Number(num2);
const division = Math.floor(Number(num1) / Number(num2));
const remainder = Number(num1) % Number(num2);
console.log(sum);
console.log(minus);
console.log(multiplication);
console.log(division);
console.log(remainder);
rl.close();
}
rl.on('line', onInput);
10430번: 나머지
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
const onInput = (input) => {
let [num1, num2, num3] = input.split(' ');
num1 = Number(num1);
num2 = Number(num2);
num3 = Number(num3);
const answer1 = (num1+num2) % num3;
const answer2 = ((num1%num3) + (num2%num3))%num3;
const answer3 = (num1*num2) % num3;
const answer4 = ((num1%num3) * (num2%num3))%num3;
console.log(Math.floor(answer1));
console.log(Math.floor(answer2));
console.log(Math.floor(answer3));
console.log(Math.floor(answer4));
rl.close();
}
rl.on('line', onInput);
2588번: 곱셈
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
let array = [];
const onInput = (input) => array.push(input);
const onOperation = (num1, num2) => {
return Number(num1) * Number(num2);
}
const onClose = () => {
let [num1, num2] = array;
for(let i=num2.length-1; i>=0; i--) {
console.log(onOperation(num1, num2[i]));
}
console.log(onOperation(num1, num2))
process.exit();
}
rl.on('line', onInput)
.on('close', onClose);