摘要: 其实做这题我一眼DP... 设$f[i]$表示前$i$天能够获得的最大利润(肯定未持股) 有$f[i]=max(f[i-1],a[i]-a[j]+f[j-1])$,第一个决策表示未在当天购入股票 稍微优化即可,复杂度为$O(n)$ ``` #include using namespace std; 阅读全文
posted @ 2023-07-15 22:32 最爱丁珰 阅读(4) 评论(0) 推荐(0) 编辑