✏️ 문제(2739 / 구구단 / node.js)
📝 해답
const fs = require('fs');
const input = fs.readFileSync('/dev/stdin');
const number = Number(input);
for (let i = 1; i < 10; i++) {
console.log(`${number} * ${i} = ${number * i}`);
}
✏️ 문제(10950 / A+B - 3 / node.js)
📝 해답
const fs = require('fs');
const input = fs.readFileSync('/dev/stdin').toString().split('\n');
const T = input.shift();
for (let i = 0; i < T; i++) {
const A = parseInt(input[i][0]);
const B = parseInt(input[i][2]);
console.log(A + B);
}
✏️ 문제(8393 / 합 / node.js)
📝 해답
const fs = require('fs');
const input = fs.readFileSync('/dev/stdin');
const N = Number(input);
let sum = 0;
for (let i = 1; i <= N; i++) {
sum += i;
}
console.log(sum);
✏️ 문제(25304 / 영수증 / node.js)
📝 해답
const fs = require('fs');
const input = fs.readFileSync('/dev/stdin').toString().split('\n');
const X = Number(input.shift());
const N = Number(input.shift());
let sum = 0;
for (let i = 0; i < N; i++) {
const [a, b] = input[i].split(' ');
const onePrice = Number(a) * Number(b);
sum += onePrice;
}
if (sum === X) console.log('Yes');
else console.log('No');
✏️ 문제(15552 / 빠른 A+B / node.js)
📝 해답
const fs = require('fs');
const input = fs.readFileSync('/dev/stdin').toString().split('\n');
const T = Number(input.shift());
let sum = '';
for (let i = 0; i < T; i++) {
let num = input[i].split(' ');
sum += Number(num[0]) + Number(num[1]) + '\n';
}
console.log(sum);
✏️ 문제(11021 / A+B -7 / node.js)
📝 해답
const fs = require('fs');
const input = fs.readFileSync('/dev/stdin').toString().split('\n');
const T = Number(input.shift());
for (let i = 0; i < T; i++) {
const [a, b] = input[i].split(' ');
const sum = Number(a) + Number(b);
console.log(`Case #${i + 1}: ${sum}`);
}
✏️ 문제(11022 / A+B -8 / node.js)
📝 해답
const fs = require('fs');
const input = fs.readFileSync('/dev/stdin').toString().split('\n');
const T = Number(input.shift());
for (let i = 0; i < T; i++) {
const [a, b] = input[i].split(' ');
const sum = Number(a) + Number(b);
console.log(`Case #${i + 1}: ${a} + ${b} = ${sum}`);
}
✏️ 문제(2438 / 별 찍기 -1 / node.js)
📝 해답
const fs = require('fs');
const input = fs.readFileSync('/dev/stdin');
const N = Number(input);
let answer = '';
for (let i = 0; i < N; i++) {
answer += '*';
console.log(answer);
}
✏️ 문제(2439 / 별 찍기 -2 / node.js)
📝 해답
const fs = require('fs');
const input = fs.readFileSync('/dev/stdin');
const N = Number(input);
let star = '';
let space = '';
for (let i = 1; i <= N; i++) {
star += '*';
for (let j = 0; j < N - i; j++) {
space += ' ';
}
console.log(space + star);
space = '';
}
✏️ 문제(10952 / A+B -5 / node.js)
📝 해답
const fs = require('fs');
const input = fs.readFileSync('/dev/stdin').toString().split('\n');
let i = 0;
while (true) {
const [A, B] = input[i].split(' ');
if (A == 0 && B == 0) break;
i++;
console.log(Number(A) + Number(B));
}
✏️ 문제(10951 / A+B -4 / node.js)
📝 해답
const fs = require('fs');
const input = fs.readFileSync('/dev/stdin').toString().split('\n');
let i = 0;
while (input[i] != '') {
const [A, B] = input[i].split(' ');
i++;
console.log(Number(A) + Number(B));
}
✏️ 문제(1110 / 더하기 사이클 / node.js)
📝 해답
const fs = require('fs');
const input = fs.readFileSync('/dev/stdin');
const N = Number(input);
let num = N;
let i = 0;
let newNum;
while (N != newNum) {
let sum = Math.floor(num / 10) + (num % 10);
newNum = (num % 10) * 10 + (sum % 10);
num = newNum;
i++;
}
console.log(i);
'Algorithm' 카테고리의 다른 글
백준 함수 (4673/1065) node.js (0) | 2023.01.28 |
---|---|
백준 1차원 배열 (10807/10871/10818/2562/5597/3052/1546/8958/4344) node.js (0) | 2023.01.23 |
백준 조건문 (1330/9498/2753/14681/2884/2525/2480) node.js (0) | 2023.01.20 |
백준 입출력과 사칙연산 (2557/1000/1001/10998/1008/10869/10926/18108/3003/ 10430/2588/10171/10172/25083)node.js (0) | 2023.01.19 |
11399 ATM node.js (0) | 2022.01.02 |
댓글