线段树应用:
有一个数列,初始时为 a1,a2,… aN (N
1) 将 ai 的值加上 val ;
2) 对于一个区间[l,r],该区间的和。
3) 对于一个区间[l,r],求该区间的最大值。
数据结构:
//Node Type
struct Node{
int left, right;
int max, sum;
} tree[maxn];
/*
tree[k]'...
分类:
其他好文 时间:
2014-07-08 21:31:33
阅读次数:
237
Velocity知识点总结
1. 变量
(1)变量的定义:
#set($name = "hello") 说明:velocity中变量是弱类型的。
当使用#set 指令时,括在双引号中的字面字符串将解析和重新解释,如下所示:
#set($directoryRoot = "www" )
#set($templateName = "index.vm" )
...
分类:
其他好文 时间:
2014-07-08 20:55:01
阅读次数:
195
不同进制的书写方式
八进制(Octal) 0o377十六进制(Hex) 0xFF二进制(Binary) 0b11111111
不同进制之间的转换
python提供了三个内置的函数,可以用来在不同进制间做转换。
>>> oct(255), hex(255), bin(255)
('0o377', '0xff', '0b11111111')
还可以使用int函数,把字符串转成数值
>...
分类:
编程语言 时间:
2014-07-08 20:53:09
阅读次数:
195
http://poj.org/problem?id=2513
最初看到 第一感觉---map 一看250000的数据量 果断放弃
然后记得以前看过,trie代替map,尤其当数据量特别大的时候
学到了:
1、Trie代替map的思想,可以在单词结尾的tree[i][tk] 这个i作为字符串对应的int值 ,当然这个int值也可以用于建立并查集
2、接上,通过并查集判断,所有的点在同一...
分类:
移动开发 时间:
2014-07-08 19:09:11
阅读次数:
204
最近在玩Thinkphp,废话不多说,说正事.
客户端js提交代码
1 $.post('http://localhost/app/index.php/Index/Index/handle',{username : document.getElementById('username').value,content : document.getElementById('content')....
分类:
Web程序 时间:
2014-07-08 18:44:07
阅读次数:
231
地形元素
一般情况下,为了使游戏更具有美观性,会在游戏地形上放置很多的元素,这些元素是与地形分开的。主要包括:树木,草地,自定义网格模型。
树元素
首先导入系统提供的树木标准资源包,在project视图中,点击鼠标右键,然后从菜单中选择import-----tree creator。接着在地形菜单里点击第五个按钮,添加树模型。然后点击edit trees按钮,将弹出如下列表:...
分类:
其他好文 时间:
2014-07-08 18:24:33
阅读次数:
266
区间颜色不一致就更新到底,否则lazy标记
#include
#include
#include
#include
using namespace std;
#define lc l,m,index<<1
#define rc m+1,r,index<<1|1
#define N 100005
#define ll __int64
struct node
{
bool same;
ll c...
分类:
其他好文 时间:
2014-07-08 18:00:56
阅读次数:
226
直接上代码:#include //必要的头文件,使用Windows API函数
#include
int index = 0;
int tickets = 100;//票数
HANDLE hMutex; //使用全局的互斥对象来保证对同一资源的互斥访问与操作这里是tickets
//线程处理函数原型,形式可从MSDN中拷贝
//线程1 的入口函数
DWORD WINAPI Fun1Proc...
分类:
编程语言 时间:
2014-07-08 17:12:03
阅读次数:
239
一、配置资源文件
1.下载资源文件http://download.csdn.net/detail/hhxin635612026/7602027
2.新建myeclipse项目,放入相应位置,如图1-1所示
图1-1
3.在index.jsp中引入javascript等资源文件...
分类:
Web程序 时间:
2014-07-08 15:55:10
阅读次数:
193
Unique Binary Search Trees
My Submissions
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?
For example,
Given n = 3, there are a total of 5 uniqu...
分类:
其他好文 时间:
2014-07-08 14:18:39
阅读次数:
159