백준 10773
-
boj)10773 - 제로PS/boj 2020. 10. 12. 11:08
import java.io.*; import java.util.Stack; public class boj_10773 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static Stack s = new Stack(); public static void main(String[] args) throws IOException { long ans = 0; int k = Integer.parseInt(br.readLine()); for (int i = 0; i < k; i++) { int val = Integer.parseInt(br.readLine()); if (val == 0) { ans -= s.pop(); ..