//最长上升子序列(n^2)
//入口参数:1.数组名称 2.数组长度(从0开始)
int LIS(int a[],int len)
{
int *dp=new int[len];
int ans=1;
dp[0]=1;
for(int i=1;i<len;i++)
{
int m=0;
for(int j=0;jm && a[j]<a...
分类:
其他好文 时间:
2014-06-28 09:19:23
阅读次数:
220
core-site.xml
name
value
Description
fs.default.name
hdfs://hadoopmaster:9000
定义HadoopMaster的URI和端口
fs.checkpoint.dir
/opt/data/hadoop1/hdfs/namesecondar...
分类:
其他好文 时间:
2014-06-28 08:42:16
阅读次数:
285
题意:h,w,n:有一个h*w尺寸的木板,n张1*wi的海报,贴海报的位置尽量高,尽量往左,问每张海报贴的高度
看到1
关键在怎么建树,这里我们对h进行分割,每个高度都有等长的w,我们从上往下贴,如果当前高度
(在同一高度上l==r)的长度可以满足wi则可以贴,否则继续往下寻找。
#include
#include
#include
#include
...
分类:
其他好文 时间:
2014-06-28 08:13:53
阅读次数:
205
2-sat经典建图,注意AND为1的时候,a=0要和a=1连边,b同理,因为此时a,b都不能为0。
OR为0时候,a=1要和a=0连边,b同理,因为此时a,b都不能为1。
#include
#include
#include
#include
#include
#include
using namespace std;
#define maxn 1005
vector g[maxn*2];
b...
分类:
其他好文 时间:
2014-06-28 07:52:39
阅读次数:
197
//创建
UIImagePickerController *imagePick = [[UIImagePickerController
alloc]
init];
imagePick.delegate =
self;
imagePick.allowsEditing =
YES;
imagePick.sourceType ...
分类:
其他好文 时间:
2014-06-28 07:49:26
阅读次数:
248
学习过C语言的同学都知道,再写代码的时候,位操作运算总比算数运算操作快,
本文就是用C语言提供的位运算实现两个数的加法。
本文使用的代码都经过调试正常并且能够运行,调试环境centos gcc 一下是实现代码,以及测试结果:
#include
#include
int main(int argc, char **argv)
{
int add_a,add_b;...
分类:
其他好文 时间:
2014-06-28 07:26:38
阅读次数:
183
对于叶子节点和非叶子节点非别列公式。
然后化简公式。
和非树上的差不多。。
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define eps 1e-9
#define zero(x) ((fabs(x)<eps?0:x))
#define maxn 11000
#de...
分类:
其他好文 时间:
2014-06-28 07:15:49
阅读次数:
263
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
//import java.sql.Statement;
import java.sql.PreparedStatement;
public class lx02{
public static void main(S...
分类:
数据库 时间:
2014-06-28 07:09:10
阅读次数:
253
题目:
输入一个n个节点的无根树的各条边,并指定一个根节点,要求把该树转化为有根树,输出各个节点的父亲编号。
分析:分析在代码的注释中!
#include
#include
using namespace std;
const int MAXN = 1000;
int n, p[MAXN];
vector G[MAXN];
void dfs(int u, int fa...
分类:
其他好文 时间:
2014-06-28 06:56:57
阅读次数:
205
This question is not so difficult.
First,my thoughts were we should use a lot of code to find out the loop block,but there is no need to do that .
you just need to get every new position of char in ...
分类:
其他好文 时间:
2014-06-27 23:39:44
阅读次数:
293