[CCC 2015 S1] Zero That Out
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
题目描述
给定 个整数 ,维护一个序列,按顺序进行以下操作:
- 当 时,将序列中最后加入的数删除。
- 否则,将 加入序列。
例如:当 时,操作如下。
| 序列 | |
|---|---|
你需要计算最终序列中所有数的和。
输入格式
第一行一个整数 。
接下来 行,每行一个整数 。
输出格式
输出一行一个整数,表示最终序列中所有数的和。
4
3
0
4
0
0
10
1
3
5
4
0
0
7
0
0
6
7
提示
【数据范围】:
,。
保证在 时序列不为空。
练习
- Status
- Done
- Rule
- IOI
- Problem
- 9
- Start at
- 2023-11-15 7:00
- End at
- 2023-11-15 17:00
- Duration
- 10 hour(s)
- Host
- Partic.
- 12