From 77431c93b4f97dd1e2e90f840e4ae258073b3f0d Mon Sep 17 00:00:00 2001 From: Jethro Stapelbroek Date: Mon, 26 Jun 2023 23:34:02 +0200 Subject: [PATCH] Stand on Zanzibar --- zanzibar.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 zanzibar.py 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)