diff --git a/zanzibar.py b/zanzibar.py new file mode 100644 index 0000000..082cc5e --- /dev/null +++ b/zanzibar.py @@ -0,0 +1,14 @@ +t = int(input()) + +for _ in range(t): + sequence = list(map(int, input().split()))[:-1] + + prev_s = 1 + lb_import = 0 + + for s in sequence: + if s > (prev_s * 2): + lb_import += s - prev_s * 2 + prev_s = s + + print(lb_import)