POJ #2479 - Maximum sum】的更多相关文章

Maximum sum Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 40596   Accepted: 12663 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…
Maximum sum Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 44459   Accepted: 13794 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…
Maximum sum Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 36100   Accepted: 11213 Description Given a set of n integers: A={a1, a2,..., an}, we define a function d(A) as below: tex=d%28A%29%3D%5Cmax_%7B1%5Cleq+s_1%5Cleq+t_1%3Cs_2%5Cleq…
题目链接:http://poj.org/problem?id=2479 #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; ; const int INF = 0x3f3f3f3f; int dp1[maxn]; int dp2[maxn]; int a[maxn]; int N; int main() { int T;…
d(A) = max{sum(a[s1]..a[t1]) + sum(a[s2]..a[t2]) | 1<=s1<=t1<s2<=t2<=n} 即求两个子序列和的和的最大值. 为单个区间子序列和的最大值的变形. 左边的从左向右扫描,而右边的从右向左扫描即可. #include<cstdio> #include<algorithm> using namespace std; const int MAXN=50000+10; int left[MAXN],…
Hi, I'm back. This is a realy classic DP problem to code. 1. You have to be crystal clear about what you are going to solve.2. Apparently there are 2 DP sections3. Think carefully about recurrence relations5. Details: take care of indices boundaries…
转自 CSND 想看更多的解题报告: http://blog.csdn.net/wangjian8006/article/details/7870410                                      转载请注明出处:http://blog.csdn.net/wangjian8006 题目大意: 对于连续的整数和的串s1和s2,s1与s2不相交,使得s1+s2最大 解题方法: DP.  lt[i]代表以第i个元素结尾的串最大值  rt[i]代表以第i个元素开头的串的最大…
 题意:给定n个数,求两段连续不重叠子段的最大和. 思路非常easy.把原串划为两段.求两段的连续最大子串和之和,这里要先预处理一下,用lmax数组表示1到i的最大连续子串和,用rmax数组表示n到i的最大连续子串和,这样将时间复杂度降为O(n). #include<cstdio> #include<cstring> #include<cmath> #include<cstdlib> #include<iostream> #include&l…
Maximum sum Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 30704   Accepted: 9408 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 of…
Maximum sum Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 39599   Accepted: 12370 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…