洛谷P1108 低价购买
题链
一篇题解
容我把代码拷过来,便于解释吧
好干净的思路
#include <bits/stdc++.h>
using namespace std;
const int maxn = 5005;
int n, a[maxn];
int dp[maxn];
//f[i]表示a[i]结尾的,最优长度的方案数
//因为如果dp[i]==ans1,ans1就是其最优长度
//此时只需统计a[i]结尾的,最优长度的方案数
int f[maxn];
int main() {
ios::sync_wit
原创
2021-12-14 22:15:28 ·
1204 阅读 ·
0 评论