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
Oracle简易界面工具
背景:偶在远程机上干活,需要调用到 Oracle 11g服务器的数据,远程机上已安装Oracle client, 但 sql plus 和 sql developer 及 pl sql developer 都不能用 (DBA折腾几天都没解决)。偶 有服务器的ip, oracle用户名及密码;知道部分表名及字段名。
因时间紧,偶只好自己写一个简易的界面工具来应急...
分类:
数据库 时间:
2014-06-02 23:56:34
阅读次数:
445
昨晚早早跪了,身体太累了,根本吃不消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
[root@localhost ~]# su - oracle
[oracle@localhost ~]$ sqlplus '/as sysdba'
SQL*Plus: Release 11.2.0.1.0 Production on Tue Apr 22 17:10:52 2014
Copyright (c) 1982, 2009, Oracle. All rights re...
分类:
数据库 时间:
2014-06-01 09:02:31
阅读次数:
802
记录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