add: swea/1859.py

This commit is contained in:
Gyubin Han
2024-05-08 16:48:17 +09:00
parent a9f7eb0b15
commit 3f0bd45fb2

14
swea/1859.py Normal file
View File

@@ -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)