不是很难,dp[i]表示到位置i的最小花费 #include<bits/stdc++.h> using namespace std; #define ll long long #define maxn 2005 struct Node {int pos,w;}p[maxn]; struct Seg {int l,r;}seg[maxn]; int n,m,a,f[maxn]; ll dp[maxn]; int cmp(Node a,Node b){return a.pos<b.pos;}…
Maximum sum Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 33918 Accepted: 10504 Description Given a set of n integers: A={a1, a2,..., an}, we define a function d(A) as below: Your task is to calculate d(A). Input The input consists o…