Skip to content

Commit 7206d8f

Browse files
committed
[D2] Title: 백만 장자 프로젝트, Time: 659 ms, Memory: 181,128 KB -BaekjoonHub
1 parent 5d2137b commit 7206d8f

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# [D2] 백만 장자 프로젝트 - 1859
2+
3+
[문제 링크](https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5LrsUaDxcDFAXc)
4+
5+
### 성능 요약
6+
7+
메모리: 181,128 KB, 시간: 659 ms, 코드길이: 316 Bytes
8+
9+
### 제출 일자
10+
11+
2025-04-29 15:43
12+
13+
14+
15+
> 출처: SW Expert Academy, https://swexpertacademy.com/main/code/problem/problemList.do
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
T = int(input())
2+
for t in range(T):
3+
N = int(input())
4+
nums = list(map(int, input().split()))
5+
max_price = 0
6+
profit = 0
7+
8+
for i in range(N-1, -1, -1):
9+
if nums[i] > max_price:
10+
max_price = nums[i]
11+
else:
12+
profit += max_price - nums[i]
13+
print(f"#{t+1} {profit}")

0 commit comments

Comments
 (0)