题解(没有思路的同学看这里)

tctm135 2023-11-26 11:09:37 9

这道题是线性dp,其实就是最长下降子序列 核心代码: for (int i = 1; i <= n; i++) { dp[i] = 1; for (int j = 1; j <= i - 1; j++) { if (a[i] < a[j]) { dp[i] = max(dp[i],dp[j]+1 ); } } mx = max(mx, dp[i]); } cout << mx;

{{ vote && vote.total.up }}