码迷,mamicode.com
首页 >  
搜索关键字:algorithm    ( 11758个结果)
线段树之单点更新求和hdoj1166
题目:hdoj1166 分析:题意很清晰,就是让你给某个点又增加或者减少x个,然后求某一段有多少个,我是用一个father数组保存叶子节点的编号,然后直接从当前节点开始,更轻到root就ok。 查询的话,从根节点开始,看在左子区间还是右子区间,直接查询到某一段全部在要查询的区间内,求和就ok,很简单。 代码: #include #include #include ...
分类:其他好文   时间:2014-07-22 14:33:54    阅读次数:231
线段树单点更新区间最大值 hdoj1754I Hate It
题目:hdoj1754 I  Hate It 分析:更新的话,建树的时候保存叶子编号的的节点信息,然后从下往上更新就ok。 求和的话,从根节点开始,然后找在根的左边还是右边,然后递归找一个所有中的最大值即可、 代码: #include #include #include using namespace std; const int N = 205000; struct...
分类:其他好文   时间:2014-07-22 14:33:36    阅读次数:179
min_element()与max_element()
algorithm之min_element()与max_element()...
分类:其他好文   时间:2014-07-22 14:17:49    阅读次数:172
Search a 2D Matrix leetcode java
题目:Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorte....
分类:编程语言   时间:2014-07-22 00:35:34    阅读次数:290
LeetCode:Single Number II
Given an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a linear runtime comp...
分类:其他好文   时间:2014-07-22 00:28:38    阅读次数:209
ACM——Quicksum
Quicksum时间限制(普通/Java):1000MS/3000MS 运行内存限制:65536KByte总提交:615 测试通过:256描述A checksum is an algorithm that scans a packet of data and returns a s...
分类:其他好文   时间:2014-07-22 00:25:37    阅读次数:249
【leetcode】Search for a Range
Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the ord...
分类:其他好文   时间:2014-07-22 00:13:35    阅读次数:154
POJ3185 The Water Bowls 反转(开关)
Description The cows have a line of 20 water bowls from which they drink. The bowls can be either right-side-up (properly oriented to serve refreshing cool water) or upside-down (a position which h...
分类:其他好文   时间:2014-07-21 22:32:18    阅读次数:278
poj 2804 词典 (字典树 或者 快排+二分)
2804:词典 总时间限制: 3000ms 内存限制: 65536kB 描述 你旅游到了一个国外的城市。那里的人们说的外国语言你不能理解。不过幸运的是,你有一本词典可以帮助你。 输入 首先输入一个词典,词典中包含不超过100000个词条,每个词条占据一行。每一个词条包括一个英文单词和一个外语单词,两个单词之间用一个空格隔开。而且在词典中不会有某个外语单...
分类:其他好文   时间:2014-07-21 16:23:12    阅读次数:237
HDU 3397 Sequence operation (线段树,成段更新,区间合并)
http://acm.hdu.edu.cn/showproblem.php?pid=3397 Sequence operation Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 5801    Accepted Subm...
分类:其他好文   时间:2014-07-21 11:45:44    阅读次数:244
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!