TIL/python (1) 썸네일형 리스트형 코딩테스트 (SWEA -d2) - python https://swexpertacademy.com/main/code/problem/problemSubmitDetail.do 1 2 3 4 5 6 7 8 9 10 11 12 13 14 T = int(input()) for i in range(T): N = int(input()) Price = list(map(int, input().split())) Max_Price = Price[-1] profit = 0 for j in range(N-2, -1,-1): if Price[j] >= Max_Price: Max_Price = Price[j] else: profit += (Max_Price - Price[j]) print(f"#{i+1} {profit}") - 이윤을 최대로 남기는 것이 목적이므로, 제일 뒷 원.. 이전 1 다음