摘要:
``` //将含有N个元素的一个集合分成M个子集,使得每个子集的最大值与最小值平方差的和最小。 #include #include #include #include using namespace std; typedef long long ll; const int maxn = 1e4+50; const int maxm = 5e3+50; ll dp[maxn][maxm] ,v[ma 阅读全文
摘要:
参考博客https://blog.csdn.net/qq_26572969/article/details/47155559 阅读全文
摘要:
```#include#include#include#includeusing namespace std;const int N=1e5;int val[N],sum[N],dp[N];int q[N],r,l;int getup(int r,int l) { return dp[r]-dp[l];}int getdown(int r,int l) { return sum[r]-... 阅读全文
摘要:
``` #include #include #include #include using namespace std; typedef long long ll; const int N= 500000+10; int q[N],l,r; ll sum[N],val[N]; ll dp[N]; int n,m; ll getdown(int j,int k) { return val[j+1]- 阅读全文
摘要:
``` //考虑在V个村庄中只建立【一个】邮局的情况,显然可以知道, //将邮局建立在中间的那个村庄即可。也就是在a到b间建立一个邮局, //若使消耗最小,则应该将邮局建立在(a+b)/2这个村庄上 //下面考虑建立【多个】邮局的问题,可以这样将该问题拆分为若干子问题, //在前i个村庄中建立j个邮局的最短距离, //是在前【k】个村庄中建立【j-1】个邮局的最短距离 与 //在【k+1】到第i个 阅读全文
摘要:
``` #include #include #include #include using namespace std; typedef long long ll; const int N=4e5+50; int q[N],l,r; ll sum[N],val[N]; ll dp[N]; int n,m; ll getdown(int j,int k) { return val[j+1]-val[ 阅读全文
摘要:
``` #include #include #include #include using namespace std; const int N=1e5+10; int sum[N],dp[N]; int q[N]; inline double calc(int j,int i) { return (double)(sum[i]-sum[j])/(i-j); } int main() { int 阅读全文
摘要:
debug半天,也没找出错误,就是卡fread快读有点恶心, 参考博客https://blog.csdn.net/zyszlb2003/article/details/94427222 #include<stdio.h> #include<iostream> #include<string.h> # 阅读全文