We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 38e13a1 commit d240039Copy full SHA for d240039
2 files changed
백준/Silver/10773. 제로/README.md
@@ -4,15 +4,15 @@
4
5
### 성능 요약
6
7
-메모리: 31900 KB, 시간: 88 ms
+메모리: 16976 KB, 시간: 184 ms
8
9
### 분류
10
11
-자료 구조, 구현, 스택
+구현, 자료 구조, 스택
12
13
### 제출 일자
14
15
-2024년 4월 12일 11:20:30
+2026년 3월 5일 17:45:00
16
17
### 문제 설명
18
백준/Silver/10773. 제로/제로.js
@@ -0,0 +1,21 @@
1
+// /dev/stdin
2
+const input = require("fs")
3
+ .readFileSync("/dev/stdin")
+ .toString()
+ .trim()
+ .split("\n")
+ .map((x) => x.replace("\r", ""));
+
+const N = Number(input[0]);
+const stack = [];
+for (let i = 1; i <= N; i++) {
+ if (input[i] == 0) {
+ stack.pop();
+ } else {
+ stack.push(Number(input[i]));
+ }
19
+}
20
21
+console.log(stack.reduce((acc, cur) => acc + cur, 0));
0 commit comments