Skip to content

Commit 1cf2157

Browse files
committed
[D2] Title: 백만 장자 프로젝트, Time: 686 ms, Memory: 183,800 KB -BaekjoonHub
1 parent 9f2fd95 commit 1cf2157

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

SWEA/D2/1859. 백만 장자 프로젝트/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
### 성능 요약
66

7-
메모리: 181,128 KB, 시간: 659 ms, 코드길이: 316 Bytes
7+
메모리: 183,800 KB, 시간: 686 ms, 코드길이: 318 Bytes
88

99
### 제출 일자
1010

11-
2025-04-29 15:43
11+
2025-05-23 20:54
1212

1313

1414

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
T = int(input())
2-
for t in range(T):
2+
3+
for tc in range(1, T+1):
34
N = int(input())
45
nums = list(map(int, input().split()))
5-
max_price = 0
6-
profit = 0
6+
max_profit = 0
7+
ans = 0
78

89
for i in range(N-1, -1, -1):
9-
if nums[i] > max_price:
10-
max_price = nums[i]
10+
if nums[i] > max_profit:
11+
max_profit = nums[i]
1112
else:
12-
profit += max_price - nums[i]
13-
print(f"#{t+1} {profit}")
13+
ans += max_profit - nums[i]
14+
15+
print(f"#{tc} {ans}")

0 commit comments

Comments
 (0)