Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 |
Tags
- 파이썬
- 가상메모리
- 스택
- level0
- 힙
- python
- 재귀
- 딕셔너리
- programmers
- DP
- 구현
- dict
- dfs
- BFS
- level3
- 가상메모리 관리
- 다익스트라
- level1
- 그리디
- N과M
- 백준
- 코딩테스트
- 프로그래머스
- BOJ
- MYSQL
- level2
- 브루트포스
- 다이나믹 프로그래밍
- 운영체제
- 수학
Archives
- Today
- Total
동캄의 코딩도장
백준 11501 [주식]파이썬 본문
https://www.acmicpc.net/problem/11501
#백준 11501
for i in range(int(input())):
d=int(input())
lst=list(map(int,input().split()))
ans=0
M=0
for i in range(d-1,0,-1):
M=max(M,lst[i])
if M>lst[i-1]:
ans+=(M-lst[i-1])
else:
pass
print(ans)
그리디 한 문제이다.
'코테 > BOJ' 카테고리의 다른 글
백준 12845 [모두의 마블] 파이썬 (2) | 2022.09.03 |
---|---|
백준 2012 [등수 매기기] 파이썬 (0) | 2022.09.03 |
백준 1449 [수리공 항승] 파이썬 (0) | 2022.09.03 |
백준 16162 [가희와 3단 고음] 파이썬 (0) | 2022.09.03 |
백준 20300 [서강근육맨] 파이썬 (0) | 2022.09.03 |