#includeint sum(int* a, int n){ return (0 ==
n)?0:(sum(a,n-1) + a[n-1]);}void sum1(int* a, int n,int& s){ if(0 == n)
return; else {...
分类:
其他好文 时间:
2014-05-19 20:33:20
阅读次数:
381
template html(模板文件): 有如下一个form:from django import
formsclass UploadFileForm(forms.Form): title = forms.CharField(max_length=50)
file ...
分类:
其他好文 时间:
2014-05-19 11:45:23
阅读次数:
317
linux 引入了 Node的概念7 bootmem_data_t
bootmem_node_data[MAX_NUMNODES] __initdata其中MAX_NUMNODES0005 #ifdef
CONFIG_NODES_SHIFT0006 #define NODES_SHIFT C...
分类:
系统相关 时间:
2014-05-19 11:32:43
阅读次数:
298
字典树
#ifndef TIRE_H_INCLUDED
#define TIRE_H_INCLUDED
/*
** 字典树
*/
#define MAX 26
typedef struct Node
{
int num;
struct Node* next[MAX];
}Tire;
/*
** 创建一个节点
*/
Tire* create(void);
/*
*...
分类:
其他好文 时间:
2014-05-16 02:52:23
阅读次数:
246
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero....
分类:
其他好文 时间:
2014-05-16 01:34:36
阅读次数:
293
-Xmx1024m -Xms1024m -XX:PermSize=128m
-XX:MaxPermSize=512m-------------------------亲测可用
分类:
编程语言 时间:
2014-05-16 00:41:38
阅读次数:
281
问题:
有N件物品和一个容量为V的背包。第i件物品的费用是c[i],价值是w[i]。求解将哪些物品装入背包可使价值总和最大。
思路:
这是最基础的背包问题,特点是:每种物品仅有一件,可以选择放或不放。用子问题定义状态:即f[i][v]表示前i件物品恰放入一个容量为v的背包可以获得的最大价值。则其状态转移方程便是:f[i][v]=max{f[i-1][v],f[i-1][v-c...
分类:
其他好文 时间:
2014-05-15 23:50:57
阅读次数:
421
http://acm.hdu.edu.cn/showproblem.php?pid=4811
推理一下,发现可以先求出后面放小球可以加分的最大值,然后前面的和为0 + 1 + 2 + ...+ max,max最大为6,因为每个球最多算左右两边
代码:
#include
#include
using namespace std;
long long a, b, c;
long long ...
分类:
其他好文 时间:
2014-05-15 23:04:28
阅读次数:
387
线段树维护的是区间有多少个空位置,每次查询第X个空位置在哪,sum[rt]>=X就向左区间找,sum[rt]
#include
#include
#include
using namespace std;
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
const int maxn = 55555;
int...
分类:
其他好文 时间:
2014-05-15 20:19:48
阅读次数:
256
和上一题一样,寻找第K个位置,只不过需要处理一下下一个位置在哪,画图看看就知道了。
#include
#include
#include
using namespace std;
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
const int maxn = 30000+5;
int sum[maxn<<...
分类:
其他好文 时间:
2014-05-15 20:07:28
阅读次数:
262