摘要: Problem : http://acm.hdu.edu.cn/showproblem.php?pid=1258dfs简单搜索题再简单不过了,只是关键的是同样的求和序列只能算一次感觉要来做判重处理会很难过...超无聊的人才会去判重因为1#includeusing namespace std;int t,n,k,ans,cou[20];struct Num{ int v,c;//v存数列中某个数的数值,c存该数的个数}a[20];bool cmp(Num x,Num y){ return x.v>y.v;}void put(){ int sum=0; for(int i=... 阅读全文
posted @ 2014-02-08 20:26 Cshhr 阅读(455) 评论(0) 推荐(0) 编辑
摘要: Problem from:http://acm.hdu.edu.cn/showproblem.php?pid=3276在一个数列中寻找两个不相交且不相邻长度为Len(x=0最后剩下的就是如何实现DP了:DP前,先用一个数组sum[],sum[i]存前 i 个数的 Ek假设DP[i-1]已实现,则DP[i]=max(DP[i-1] , max(sum[i]-sum[j] (xsum[i-x],是则弹出该s,直到队列为空或者不存在sum[s]>s[i-x] 再加入i-x然后判断双端队列首端的元素s,s是否#include#includeusing namespace std;const in 阅读全文
posted @ 2014-02-08 19:31 Cshhr 阅读(334) 评论(0) 推荐(0) 编辑