码迷,mamicode.com
首页 >  
搜索关键字:minimum sum lcm    ( 24851个结果
hdu 1863 畅通工程
题目:         链接:点击打开链接 题意:         中文题 算法: 思路:         赤裸裸的最小生成树。。 代码: #include #include using namespace std; struct node{ int u,v,w; } e[110]; int p[110]; int n,m,sum,ans; int cmp(node...
分类:其他好文   时间:2014-06-05 03:50:23    阅读次数:232
HDU基本最*子序列集锦1
最大连续子序列(HDU1003,1231) 最大递增子序列和,sum[i]=max(sum[j])+a[i],j 最长公共子序列,LCS经典算法(HDU1159)。 题解: 实际上,我没看出hdu1003和1231的本质差别,形式上的差别就是记载的东西不一样,一个是记载下标,一个是记载元素。基本就是那么回事吧。很多算法书在讨论时效都会拿这个例子来说明,让大家看到算法的力量,从一个弱渣算法到...
分类:其他好文   时间:2014-06-03 04:19:10    阅读次数:279
ORACLE 按表字段值的不同统计数量
select p.id comperitorId,p.compcorp competitorName, sum(case when c.kindname = 'ATM' then c.num else 0 end) atm, sum(case when c.kindname = 'CRS' then c.num else 0 end) crs, sum(case when c.kindname...
分类:数据库   时间:2014-06-03 03:12:09    阅读次数:211
UESTC 887 方伯伯的儿童节
树形DP问题。定义:1.dp[u][1]表示u这个点设立糖果发放点且u这棵子树满足条件时的最少糖果点数2.dp[u][0]表示u这个点不设立发放点且u这棵子树满足条件时的最少糖果点数设v1,v2……vn为u的子节点,则转移方程:dp[u][1]= sum(min(dp[vi][1],dp[vi][0...
分类:其他好文   时间:2014-06-02 20:35:30    阅读次数:262
UESTC 886 方老师金币堆
环状合并石子问题。环状无非是第n个要和第1个相邻。可以复制该行石子到原来那行的右边即可达到目的。定义:dp[i][j]代表从第i堆合并至第j堆所要消耗的最小体力。转移方程:dp[i][j]=min(dp[i][k]+dp[k+1][j]+sum[i][j]);复杂度:O(n^3)。可考虑四边形优化。...
分类:其他好文   时间:2014-06-02 20:34:03    阅读次数:226
UESTC 876 爱管闲事
题意:即求给定n个数字(a1,a2,……an),不改变序列,分成M份,使每一份和的乘积最大。思路:dp[i][j]表示把前i个数字,分成j份所能得到的最大乘积。转移方程:dp[i][j] = max{ dp[k][i-1]*sum(k+1,j) } 其中显然j#include #include #i...
分类:其他好文   时间:2014-06-02 19:58:45    阅读次数:242
几道算法题
1.Problem DescriptionGiven a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-...
分类:其他好文   时间:2014-06-02 17:36:53    阅读次数:234
projecteuler---->problem=10----Summation of primes
title: The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. 翻译: 10以下的质数的和为2 + 3 + 5 + 7 = 17。 请求出200,0000以下所有质数的和。 import math,time d...
分类:其他好文   时间:2014-06-01 09:12:31    阅读次数:239
projecteuler---->problem=13----Large sum
title: Work out the first ten digits of the sum of the following one-hundred 50-digit numbers. 37107287533902102798797998220837590246510135740250 4637693767749000971264812489697007805041701826053...
分类:其他好文   时间:2014-06-01 08:53:33    阅读次数:276
hdu-1255-覆盖的面积-线段树
记录3个变量。 sum[i]:当前区间被覆盖2次及两次以上的面积。 num[i]:当前区间被覆盖1次及一次以上的面积。 cover[i]:覆盖的lazy标记。 对于每一个区间. 更新操作如下: void push_up(int_now) { if(cover[rt]==0) { num[rt]=num[rt<<1]+num[rt<<1|1]; ...
分类:其他好文   时间:2014-05-31 17:58:57    阅读次数:296
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!