题目链接:https://vjudge.net/problem/HDU-1300 Pearls Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2920 Accepted Submission(s): 1464 Problem Description In Pearlania everybody is fond of pearls.…
这个题目数据量很小,但是满足斜率优化的条件,可以用斜率优化dp来做. 要注意的地方,0也是一个决策点. #include <iostream> #include <cstdio> #include <cstring> using namespace std; const int maxn=1e2+9; int dp[maxn]; int a[maxn],p[maxn],sum[maxn]; int que[maxn]; bool chk1(int i,int j,int…