반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 쉬운 문제
- 그래프
- 백준
- 레벨 1
- 자바스크립트
- javascript
- HTTP 완벽 가이드
- TCP
- dfs
- 크롤링
- Nestjs
- 가천대
- socket
- 소켓
- Node.js
- ip
- 타입 챌린지
- Algorithm
- 프로그래머스 레벨 2
- Crawling
- 알고리즘
- 타입스크립트
- 문자열
- HTTP
- 수학
- typescript
- BFS
- type challenge
- dp
- 프로그래머스
Archives
- Today
- Total
kakasoo
[node.js] 주사위 게임 ( 백준 10103번 ) 본문
반응형
// 백준 10103번 주사위 게임을 풀었습니다.
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let count = 0;
const input = [];
rl.on("line", (line) => {
if (!count) {
count = Number(line);
} else {
input.push(line);
if (input.length === count) {
main();
rl.close();
}
}
}).on("close", () => {
process.exit();
});
const main = () => {
let chang = 100;
let sang = 100;
input.forEach((el) => {
const [a, b] = el.split(" ").map(Number);
if (a > b) {
sang -= a;
} else if (a < b) {
chang -= b;
}
});
console.log(chang);
console.log(sang);
};
그래프 문제 풀다가 머리 좀 식힐 겸 ( 랭킹도 올릴 겸 간단한 문제 하나 풀어 보았다. )
사실 그래프 문제는 왠만하면 Cpp로 다 풀어봤던 것들 위주라서, 랭킹에 전혀 반영되지 않기도 하고...
한 문제 풀 때마다 한 문제 간단한 거 풀면서 머리 좀 식혀줘야겠다.
눈도 나빠지는 거 같고...
반응형
'프로그래밍 > 알고리즘 풀이' 카테고리의 다른 글
[node.js] 단지번호붙이기 ( 백준 2667번 ) (0) | 2021.04.10 |
---|---|
[node.js] 이분 그래프 ( 백준 1707번 ) (0) | 2021.04.09 |
[node.js] 연결 요소의 개수 ( 백준 11724번 ) (0) | 2021.04.09 |
[node.js] dfs와 bfs ( 백준 1260번 ) (0) | 2021.04.09 |
[node.js] 8진수 2진수 ( 백준 1212번 ) (0) | 2021.04.09 |