poj 2479 (DP)】的更多相关文章

求一个区间内连续两段不相交区间最大和. // File Name: 2479.cpp // Author: Missa_Chen // Created Time: 2013年06月22日 星期六 16时19分02秒 #include <iostream> #include <string> #include <algorithm> #include <cstdio> #include <cstring> #include <cmath>…
Maximum sum Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 38079   Accepted: 11904 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…
题目链接:http://poj.org/problem?id=2479 解题报告: 1.再求left[i]的时候,先没有考虑a[i]的正负,先把a[i]放到left[i]中,然后left=max(left[i-1],left[i]); 2.res=max(res,left[i-1]+right[i]); #include <stdio.h> #include <algorithm> using namespace std; #define MAX 50005 int a[MAX];…
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 <stdio.h> #include <iostream> using namespace std; ],righ[]; int main() { ]; scanf("%d",&t); while(t--) { scanf("%d",&n); ;i<n;i++) scanf("%d",&a…
题目 以前做过的一道题, 今天又加了一种方法 整理了一下..... 题意:给出一个字符串,问要将这个字符串变成回文串要添加最少几个字符. 方法一: 将该字符串与其反转求一次LCS,然后所求就是n减去 最长公共子串的长度. 额,,这个思路还是不是很好想. LCS: #include<iostream> #include<cstring> #include<cstdio> using namespace std; +; char s1[maxn], s2[maxn]; ][…
题目链接:http://poj.org/problem?id=1080 #include<cstdio> #include<cstring> #include<algorithm> #include<iostream> using namespace std; ; const int INF = 0x3f3f3f; int dp[maxn][maxn]; int A[maxn],B[maxn]; ][] = { {, , , , , }, {,,-,-,-,…
题目链接: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;…
题目链接:http://poj.org/problem?id=1609 #include <cstdio> #include <cstring> #include <iostream> #include <cmath> #include <algorithm> #include <queue> #include <vector> using namespace std; ; ; const int INF = 0x3f3f…