码迷,mamicode.com
首页 >  
搜索关键字:max sum plus plus    ( 46271个结果
HDU 1565
http://acm.hdu.edu.cn/showproblem.php?pid=1565先进行二分图黑白染色,S到黑,白到T,黑到白,问题转化成了求最大权独立集,最大权独立集=sum-最小点权覆盖集,最小点权覆盖集等于上图最小割#include #include #include using ....
分类:其他好文   时间:2014-08-13 21:33:07    阅读次数:207
Codeforces 75D Big Maximum Sum 最大子段和 dp
题目链接:点击打开链接 题意: 第一行 n m n个vector 下面n行 第一个数字u表示vector 的大小,然后后面u个数字给出这个vector 最后一行m个数字 表示把上面的vector拼接起来 得到一个大序列,求这个大序列的最大子段和 先预处理出每个vector的最大子段和,左起连续最大,右起连续最大,所有数的和 然后dp 一下。。 #include ...
分类:其他好文   时间:2014-08-13 18:55:07    阅读次数:266
poj 1163 The Triangle &poj 3167 Cow Bowling (dp)
题意:输入一个n层的三角形,第i层有i个数,求从第1层到第n层的所有路线中,权值之和最大的路线。 规定:第i层的某个数只能连线走到第i+1层中与它位置相邻的两个数中的一个。 状态方程:f[i][j]=max(f[i-1][j-1],f[i-1][j])+a[i][j];...
分类:其他好文   时间:2014-08-13 18:50:27    阅读次数:166
Sum Root to Leaf Numbers
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which...
分类:其他好文   时间:2014-08-13 18:17:26    阅读次数:208
hdu 2571 G++
# include int a[25][1010], vis[25][1010] ;int n, m, INF = 0x0f0f0f0f ;int max(int a, int b){return a>b?a:b;}int dfs(int x, int y){ int i, rtn = -IN...
分类:其他好文   时间:2014-08-13 18:14:06    阅读次数:219
0x7FFFFFFF
0x7FFFFFFF代表最大值INT_MAX 代表最大值, INT_MIN 代表最小值#include#include//INT_MAX与INT_MIN的头文件using namespace std;int main(){ cout<<0x7FFFFFFF<<endl;//最大值 cou...
分类:其他好文   时间:2014-08-13 18:08:26    阅读次数:207
poj 2533 poj 2533 普通递归超时1 2
#include #define N 10005using namespace std;int a[N],n,maxlen=1;int f( int x){int i,t,m;if (xa[i]) { m=max(m,t+1); if (m>maxlen) maxlen=m; } } retur.....
分类:其他好文   时间:2014-08-13 18:06:26    阅读次数:159
字典树
[syswj@host 0813]$ cat dic_tree.cpp #include #include #define MAX 26using namespace std;typedef struct TrieNode{ int ncount; struct TrieNode *ne...
分类:其他好文   时间:2014-08-13 18:04:06    阅读次数:190
leetcode 刷题之路 83 Maximum Subarray
思路:从左向右遍历数组元素相加求和得到和sum,若sum小于0,必然会对总的和有损耗,因此将sum重置为0,从当前位置继续重复上述过程,直到数组结束,与此同时设置max变量记录求和过程中遇到的最大值。 执行完上述过程,判断max等于0(max初值为0),若大于0,max为所求结果,返回max。 若仍然等于0说明求和过程中未出现过正数,数组中全是负数或0,此时数组最大和就是数组中最大的最...
分类:其他好文   时间:2014-08-13 15:01:56    阅读次数:211
hdu 4939 Stupid Tower Defense (dp)
题目大意: 简单的塔防游戏,有三种塔。 一种是减速塔,只能减速它身后的敌人,使之移动速度减慢。通过一格的时间变成加z秒。 两种攻击塔,一种只能打面前,另外一种可以打身后。 思路分析: 我们默认把只能攻击面前的塔放到最后面。 状态方程: dp [i] [j]  表示放到第 i 个位置放了 j 个防御塔能达到的最大伤害。 转移方程:dp [i] [j] =max ( dp...
分类:其他好文   时间:2014-08-13 15:00:26    阅读次数:143
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!