Baekjoon > 문제 > 단계별로 풀어보기
언어설정 : node.js
console.log("Hello World!")
// 1
console.log(`강한친구 대한육군
강한친구 대한육군`)
// 2
console.log(`강한친구 대한육군\n`.repeat(2))
// 3
for(let i = 0; i < 2; i++) console.log("강한친구 대한육군")
console.log(`\\ /\\
) ( ')
( / )
\\(__)|`);
console.log(`|\\_/|
|q p| /}
( 0 )"""\\
|"^"\` |
||_/=\\\\__|`)
// 1
var fs = require("fs")
var input = fs
.readFileSync("/dev/stdin")
.toString()
.split(" ")
.map(function(a) {
return +a
})
console.log(input[0] + input[1])
// 2
const inputs = require('fs').readFileSync('/dev/stdin').toString();
console.log( +inputs[0] + +inputs[2] );
// 3
let [a, b] = require('fs').readFileSync('./dev/stdin').toString().split(' ');
console.log(+a + +b);
let [a, b] = require('fs').readFileSync('./dev/stdin').toString().split(' ');
console.log(+a - +b);
let [a, b] = require('fs').readFileSync('./dev/stdin').toString().split(' ');
console.log(+a * +b);
let [a, b] = require('fs').readFileSync('./dev/stdin').toString().split(' ');
console.log(+a / +b);
let [a, b] = require('fs').readFileSync('./dev/stdin').toString().split(' ');
console.log(+a + +b);
console.log(+a - +b);
console.log(+a * +b);
console.log(~~(+a / +b));
console.log(+a % +b);
const [A, B, C] = require('fs').readFileSync('/dev/stdin').toString().split(' ').map(s => Number(s));
console.log((A+B)%C, ((A%C) + (B%C))%C, (A*B)%C, ((A%C) * (B%C))%C);
const [a, b] = require('fs').readFileSync('/dev/stdin').toString().split('\n');
console.log(+a * +b[2])
console.log(+a * +b[1])
console.log(+a * +b[0])
console.log(+a * +b)