Codeforces - Era
本文最後更新於:2024年1月12日 下午
Codeforces
出處
Codeforces Round 752 (Div. 2)難度
800
標籤
greedy
*800
Codeforces - Era
# Author : ysh
# 2023/12/01 Fri 21:30:24
# https://codeforces.com/problemset/problem/1604/A
for i in range(int(input())):
n = int(input())
ans = 0
f = ([int(i) for i in input().split()])
for i in f:
ans = max(ans + 1,i)
print(ans - len(f))
Codeforces - Era
http://mysh212.github.io/algosolution/Era.py/