티스토리 뷰
https://www.acmicpc.net/problem/1247
입력 10만개 넘어가면 그냥 readline으로 풀어야겠다;
아오 귀찮아
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let answer = [];
let N = 0;
let sum = BigInt(0);
rl.on('line', function (line) {
if (N == 0) {
N = Number(line);
sum = BigInt(0);
} else {
sum += BigInt(line);
N -= 1;
if (N == 0) {
if (sum > BigInt(0)) {
answer.push('+');
} else if (sum == BigInt(0)) {
answer.push('0');
} else {
answer.push('-');
}
}
}
}).on('close', function () {
console.log(answer.join('\n'));
process.exit();
});
728x90
'자료구조 알고리즘 > 백준' 카테고리의 다른 글
Node.js) 백준 11000번: 강의실 배정 (0) | 2023.08.31 |
---|---|
Node.js) 백준 1717번: 집합의 표현 (0) | 2023.08.30 |
Node.js) 백준 1100번: 하얀 칸 (0) | 2023.08.29 |
Node.js) 백준 1076번: 저항 (0) | 2023.08.28 |
Node.js) 백준 1032번: 명령 프롬프트 (0) | 2023.08.27 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- create db
- 최소공통조상
- 은둔청년체험
- 롱베케이션
- DB 생성
- 투포인터 연습
- 로드나인
- MySQL
- 면접질문
- 투포인터
- 개발자면접
- BFS
- 서버점검
- 다이나밍프로그래밍
- 서버개발
- 동적프로그래밍
- 다이나믹프로그래밍
- 그래프
- 면접비
- MOD
- create databases;
- node.js
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함