반응형

문제 출처 :

 

https://www.acmicpc.net/problem/1000

 

알고리즘 분석 :


문제 해결에 필요한 사항

1. nodejs input

 

nodejs input을 이렇게 하는지만 이해하고 있으면 될 것같다.

 

 

 
const readline = require("readline");

const rl = readline.createInterface({
  input: process.stdin,
  output: process.output,
});

var input = [];
rl.on("line", (line) => {
  input = line.split(" ").map((value) => parseInt(value));
  rl.close();
});

rl.on("close", () => {
  let ret = input.reduce((sum, cur) => sum + cur, 0);
  console.log(ret);

  process.exit();
});

 

 

const readline = require("readline");

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
});

let input = [];
rl.on("line", (line) => {
  input = line.split(" ").map((value) => parseInt(value));
  rl.close();
});

rl.on("close", () => {
  input.forEach((value) => {
    console.log(value);
  });
  process.exit();
});

 

 

반응형

'Applied > 알고리즘 문제풀이' 카테고리의 다른 글

[2739번] 구구단  (0) 2022.04.20
[1001번] A-B  (0) 2022.04.18
[2636번] 치즈  (1) 2021.06.01
[11번] Container With Most Water  (0) 2021.05.10
[35번] Search Insert Position  (0) 2021.05.07