DP求解。对Blocks的先按照X降级,再按照Y降级排序,可以转化为最长公共子序列问题,即求子序列权值之和最大。
#include
#include
#include
using namespace std;
#define MAX_SIZE 300
struct Block{
int x;
int y;
int height;
};
int nums...
分类:
其他好文 时间:
2014-06-03 04:39:44
阅读次数:
223
最大连续子序列(HDU1003,1231)
最大递增子序列和,sum[i]=max(sum[j])+a[i],j
最长公共子序列,LCS经典算法(HDU1159)。
题解:
实际上,我没看出hdu1003和1231的本质差别,形式上的差别就是记载的东西不一样,一个是记载下标,一个是记载元素。基本就是那么回事吧。很多算法书在讨论时效都会拿这个例子来说明,让大家看到算法的力量,从一个弱渣算法到...
分类:
其他好文 时间:
2014-06-03 04:19:10
阅读次数:
279
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
1.从键盘上输入5个数,输出最大的、最小的元素以及他们的下标
#include
int main(void)
{
int i, j, k, max, min;
int a[10] = {0};
printf("input number:");
for(i = 0; i
scanf("%d", &a[i]);
max = min = a[0];
j = k = 0;
...
分类:
编程语言 时间:
2014-06-03 02:43:47
阅读次数:
241
1.导入jar包:
hibernate-release-4.3.5.Final/lib/optional/*.jar
2.加入配置:
10
5
2
2000
2000
10
hibernate.c3p0.max_size: 数据库连接池的最大连接数
hibernate.c3p0.min_size: ...
分类:
系统相关 时间:
2014-06-03 00:53:00
阅读次数:
343
树形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
昨晚早早跪了,身体太累了,根本吃不消CF了,早上起来继续刷一题!Then,写写python,shell,基本又一天。
题目还是中文题~!
思路:一开始看起来这题目有dfs,但这个矩阵貌似太大了,dfs不敢碰,还是老老实实dp吧,我的做法是,先刷掉最第一列,因为第一列只能从左上往下,then,第i行第j列应该就是dp[i][j]=max(dp[i-1][j],dp[i][k] )+dp[i]...
分类:
其他好文 时间:
2014-06-01 09:49:34
阅读次数:
238
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
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
select total_user from a_user_no where date_time=(select max(date_time) from a_user_no where
‘2013-05’+ "'=to_char(date_time,‘yyyy-mm’));
通过max 函数来去5月份出现最大日期的数据...
分类:
数据库 时间:
2014-06-01 08:53:00
阅读次数:
312