Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc41cb46

Browse files
Merge pull requestyoungyangyang04#456 from hengzzha/patch-1
Update 动态规划-股票问题总结篇.md
2 parents868c18e +6360e80 commitc41cb46

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

‎problems/动态规划-股票问题总结篇.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,12 @@ dp[i][1] = max(dp[i - 1][1], dp[i - 1][3]);
381381
dp[i][2] = dp[i -1][0] + prices[i];
382382
dp[i][3] = dp[i -1][2];
383383
```
384+
```C++
385+
dp[i][0] = max(dp[i -1][0], max(dp[i -1][3]- prices[i], dp[i -1][1]) - prices[i];
386+
dp[i][1] = max(dp[i -1][1], dp[i -1][3]);
387+
dp[i][2] = dp[i -1][0] + prices[i];
388+
dp[i][3] = dp[i -1][2];
389+
```
384390

385391
整体代码如下:
386392

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp