File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 44
55### 성능 요약
66
7- 메모리: 104944 KB, 시간: 720 ms
7+ 메모리: 22944 KB, 시간: 208 ms
88
99### 분류
1010
1111구현, 자료 구조, 스택
1212
1313### 제출 일자
1414
15- 2025년 11월 1일 00:32:07
15+ 2025년 11월 1일 00:34:59
1616
1717### 문제 설명
1818
Original file line number Diff line number Diff line change 11import java .util .*;
2+ import java .io .*;
23
34public class Main {
4- public static void main (String [] args ) {
5+ public static void main (String [] args ) throws IOException {
56 Stack <Integer > stack = new Stack <>();
6- Scanner sc = new Scanner (System .in );
7- int k = sc .nextInt ();
7+ BufferedReader br = new BufferedReader (new InputStreamReader (System .in ));
8+ int k = Integer .parseInt (br .readLine ());
9+ // Scanner sc = new Scanner(System.in);
10+ // int k = sc.nextInt();
811 int sum = 0 ;
912
1013 while (k -- > 0 ){
11- int num = sc .nextInt ();
14+ // int num = sc.nextInt();
15+ int num = Integer .parseInt (br .readLine ());
1216 if (num ==0 ){
1317 sum -=stack .pop ();
1418 }else {
You can’t perform that action at this time.
0 commit comments