全局变量:由$开头,可以在程序的任何位置访问到。在初始化前,全局变量有一个特殊的值nil。这里列出了一些以$打头并跟单个字符的特殊变量,包括主要的系统变量以及它们的含义:$!
最近一次的错误信息 $@ 错误产生的位置 $_ gets最近读的字符串 $. 解释器最近读的行数(line nu...
分类:
其他好文 时间:
2014-05-21 04:30:24
阅读次数:
289
5道题目分别是:【Largest Rectangle in Histogram】、【Minimum Path Sum】、【Jump Game】、【Jump Game II 】、【Valid Number】,由于有一些题目不需要发一整篇博文来记录,所以就将这些题目以一篇博文5道来记录。...
分类:
其他好文 时间:
2014-05-21 03:05:33
阅读次数:
481
http://acm.hdu.edu.cn/showproblem.php?pid=1385
求最短路,要求输出字典序最小的路径。
spfa:拿一个pre[]记录前驱,不同的是在松弛的时候,要考虑和当前点的dis值相等的情况,解决的办法是dfs找出两条路径中字典序较小的,pre[]去更新。把路径当做字符串处理。
我只用之前的pre去更新当前点,并没考虑到起点到当前点的整个路径...
分类:
其他好文 时间:
2014-05-19 22:49:45
阅读次数:
383
Apache Module mod_reqtimeoutAvailable
Languages:enDescription:Set timeout and minimum data rate for receiving
requestsStatus:ExtensionModuleIdentifier...
分类:
其他好文 时间:
2014-05-19 19:31:41
阅读次数:
310
题目链接:HDU 1394 Minimum Inversion
Number【题意】给你一个1~N的数字组成的初始序列,然后每一次都将第一个数字移到最后,形成新的序列,然后求出这些序列的逆序数中的最小值。【思路】开始可以用任意一种方法(线段树
or 暴力 or 树状数组)计算出初始数列的逆序数sum...
分类:
其他好文 时间:
2014-05-19 09:50:31
阅读次数:
282
1、
??
Path Sum
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.
For example:
Given the below...
分类:
其他好文 时间:
2014-05-18 03:25:06
阅读次数:
301
Given a triangle, find the minimum path sum
from top to bottom. Each step you may move to adjacent numbers on the row
below.For example, given the fol...
分类:
其他好文 时间:
2014-05-18 02:11:19
阅读次数:
302
第五道树题,10分钟之内一遍AC。做树题越来越有feel~题目:求一棵树从root结点到叶子结点的最短路径。思路:仍然是递归。如果一个结点的左右子树任意一边为Null,该子树的minDepth应为非null子树的高度+1;如果一个结点的左右子树两边都非Null,则该子树的minDepth应为两个子树...
分类:
其他好文 时间:
2014-05-15 17:24:43
阅读次数:
226
划分树。只是考虑求当前区间大于第k值的值得和,和小于第k值的和。显然可以在查询的时候直接搞出来。sum[d][i]表示第d层子区间l,r种l-i的和。写错了一个下标,检查了半辈子。。。
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define MP make_...
分类:
其他好文 时间:
2014-05-14 19:31:39
阅读次数:
311
TriangleGiven a triangle, find the minimum path
sum from top to bottom. Each step you may move to adjacent numbers on the row
below.For example, given...
分类:
其他好文 时间:
2014-05-13 18:51:44
阅读次数:
297