728x90
https://www.acmicpc.net/problem/11501
와우 이정도도 이제 혼자 못 풀겠어서 다른사람 글을 참고해서 풀었다 ㅠ
코딩이 어렵진 않은문제
N = int(input())
tc = {}
for i in range(N):
int(input())
tc[i] = list(map(int, input().split()))
ans_list = []
for i in range(N):
price_max = 0
ans = 0
for comp in tc[i][::-1]:
if comp >= price_max:
price_max = comp
else :
ans += price_max - comp
ans_list.append(ans)
for ans in ans_list:
print(ans)
728x90
'코딩테스트 > 백준' 카테고리의 다른 글
백준 18818, iguana instructions 코드/풀이 (이구아나 안내하기), Python, heapq/bfs 풀이 (0) | 2022.06.04 |
---|---|
백준 17281 ⚾ 문제 코드/해설 (파이썬), 구현 문제, 삼성 A형 기출 (0) | 2022.01.05 |
백준 11559번 puyo puyo 풀이, 코드 (파이썬) 골드4, 구현 + 그래프 문제 (0) | 2021.12.18 |
백준 11049 풀이/코드(파이썬), 골드3 다이나믹 프로그래밍 문제 (0) | 2021.12.15 |
백준 8911번 거북이 파이썬 해설/코드 (실버2, 쉬운 구현 연습 문제) (0) | 2021.12.13 |