From 3f0bd45fb2a60b1cddbaacdb68cccd8fbcbfc64c Mon Sep 17 00:00:00 2001 From: Gyubin Han <89185979+Gyubin-Han@users.noreply.github.com> Date: Wed, 8 May 2024 16:48:17 +0900 Subject: [PATCH] add: swea/1859.py --- swea/1859.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 swea/1859.py diff --git a/swea/1859.py b/swea/1859.py new file mode 100644 index 0000000..b8fb1dc --- /dev/null +++ b/swea/1859.py @@ -0,0 +1,14 @@ +t=int(input()) + +for tc in range(1,t+1): + n=int(input()) + arr=list(map(int,input().split())) + + mx=0 + r=0 + for i in range(1,n+1): + if arr[-i]>mx: + mx=arr[-i] + else: + r+=mx-arr[-i] + print("#"+str(tc),r)