码迷,mamicode.com
首页 >  
搜索关键字:max sum plus plus    ( 46271个结果
Combination Sum II leetcode java
题目:Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each ....
分类:编程语言   时间:2014-08-02 01:48:12    阅读次数:246
UVA108 - Maximum Sum(最大连续和)
题意:从一个n*n的矩阵中找出和最大的子矩阵 思路:最大连续和的求解。我们可以将二维的转化为一维进行计算。sum[i][j]表示以(1, 1)和(i, j)为对角的矩阵的和。之后只要逐个枚举每个可能出现的值,保存最大值即可。 #include #include #include #include using namespace std; const int INF ...
分类:其他好文   时间:2014-08-01 23:16:52    阅读次数:283
大数乘法 (poj2389)
模板 #include #include #include #include using namespace std; void cheng( char *a, char *b, char *sum ) { int temp[2500]; int lena,lenb,l; lena=strlen(a); lenb=strlen(b); int len = lena + lenb...
分类:其他好文   时间:2014-08-01 23:15:52    阅读次数:309
HDU2602_Bone Collector(背包/01背包)
解题报告 题意: 容量为v的大小,物品数n,每个物品有价值和容量,求能装进包的最大价值。 思路: 基础01背包。 dp[j]=max(dp[j],dp[j-c[i]]+w[i]) #include #include #include #define inf 99999999 using namespace std; int main() { int t,i,j,n,v,...
分类:其他好文   时间:2014-08-01 23:07:32    阅读次数:284
iOS开发Swift篇—(八)函数(2)
iOS开发Swift篇—(八)函数(2)一、函数类型函数类型也是数据类型的一种,它由形参类型和返回值类型组成,格式是(形参类型列表) -> 返回值类型1 func sum(num1: Int, num2: Int) -> Int {2 return num1 + num23 }sum函数的函...
分类:移动开发   时间:2014-08-01 22:54:02    阅读次数:211
zju 2478
-#include using namespace std;int main(int argc, char *argv[]){ int n,i,sum; string s; cin>>n; while(n--) { cin>>s; for(i=0,sum=1;s[i];i++) { if(...
分类:其他好文   时间:2014-08-01 22:51:42    阅读次数:214
Maximum Depth of Binary Tree
问题:二叉树的最深深度class Solution{public: void dfs(TreeNode *root,int step,int &MAX) { if(root==NULL) { if(MAXleft,step+1); ...
分类:其他好文   时间:2014-08-01 22:49:02    阅读次数:202
可以连续几行数,,,分别相加求和
Sample input:24 1 2 3 4 5 1 2 3 4 5 Sample output: 10 15 // C语言AC代码#include int n,c,t,sum; int main() { while( s...
分类:其他好文   时间:2014-08-01 22:47:02    阅读次数:279
poj1270拓扑排序
题意:给定一些大小关系,把关系从大到小排序,如果有多种相同关系就按字典序排序。例如 x #include#include#includeconst int maxn = 200;char var[maxn];char ans[maxn];char st[maxn];int map[maxn][max...
分类:其他好文   时间:2014-08-01 22:45:02    阅读次数:192
石子合并(四边形不等式优化dp)
该来的总是要来的————————经典问题,石子合并。 对于 f[i][j]= min{f[i][k]+f[k+1][j]+w[i][j]}From 黑书凸四边形不等式:w[a][c]+w[b][d]#include #define N 1005int s[N][N],f[N][N],sum[N],....
分类:其他好文   时间:2014-08-01 22:44:12    阅读次数:305
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!