블로그를 이전하였습니다. 2023년 11월부터 https://bluemiv.github.io/에서 블로그를 운영하려고 합니다. 앞으로 해당 블로그의 댓글은 읽지 못할 수 도 있으니 양해바랍니다.
반응형
문제의 저작권은 백준 알고리즘(https://www.acmicpc.net/)에 있습니다
1. 문제
![](http://t1.daumcdn.net/tistory_admin/static/images/xBoxReplace_250.png)
2. 풀이
단순히 입력 받아서 두 수를 더한 값을 출력해주면 되는 간단한 문제이다.
<javascript />
const solution = (input) =>
input
.map((l) => {
const [a, b] = l.split(' ').map((s) => +s);
return a + b;
})
.join('\n');
const input = [];
require('readline')
.createInterface({ input: process.stdin })
.on('line', (line) => input.push(line))
.on('close', (_) => {
console.log(solution(input));
process.exit(0);
});
전체 코드
https://github.com/bluemiv/Algorithm/blob/master/baekjoon/nodejs/src/ex10/ex10951.js
GitHub - bluemiv/Algorithm: 알고리즘 풀이
알고리즘 풀이. Contribute to bluemiv/Algorithm development by creating an account on GitHub.
github.com
2.1. 풀이 결과
![](http://t1.daumcdn.net/tistory_admin/static/images/xBoxReplace_250.png)
3. 관련 글
2022.07.21 - [Algorithm/Beakjoon] - jest 단위테스트를 이용하여 백준 알고리즘 문제 편하게 풀기
jest 단위테스트를 이용하여 백준 알고리즘 문제 편하게 풀기
쉬운 문제는 웹 사이트에서 풀어도 되지만, 복잡한 문제는 여러 경우의 케이스에 대해서 실행해보는 경우가 생긴다. 백준에서는 다른 알고리즘 문제 사이트와 다르게 웹에서 실행해볼수가 없어
memostack.tistory.com
반응형
'Algorithm > Beakjoon' 카테고리의 다른 글
백준 2562번 / 최댓값 (nodejs 알고리즘 풀이) (0) | 2022.08.09 |
---|---|
백준 1110번 / 더하기 사이클 (nodejs 알고리즘 풀이) (0) | 2022.08.07 |
백준 10952번 / A+B - 5 (nodejs 알고리즘 풀이) (0) | 2022.08.05 |
백준 10871번 / X보다 작은 수 (nodejs 알고리즘 풀이) (0) | 2022.08.04 |
백준 2439번 / 별 찍기 - 2 (nodejs 알고리즘 풀이) (0) | 2022.08.03 |