# C1. Powering the Hero
## 題目連結: [codeforces](https://codeforces.com/contest/1800/problem/C1)
## 解題想法
* `bonus`陣列紀錄所有bonus的數字
* 如果出現hero card(數字是0),就找出`bonus`裡面數字最大的,加到`point`並把這個數字刪掉
## 程式碼
```py=
n = int(input())
for i in range(n):
num = int(input())
data = [int(j) for j in input().split()]
bonus = []
point = 0
for j in data:
if j == 0:
if len(bonus) > 0:
point += bonus.pop(bonus.index(max(bonus)))
else:
bonus.append(j)
print(point)
```