参考:点击打开链接 点击打开链接 点击打开链接(一些总结) 点击打开链接(不错的模板)
题目:点击打开链接
花了4天时间做完了这个专题,LCA的问题用处还是很大,同时能体会RMQ的ST算法中dp的味道.基本方法就是ST,LCA转RMQ,LCA的Tarjan,LCA倍增(这个可存储边权)
这个专题后面四道题都非常好,推荐大家做做.
细节:
1. ST方法2^i 包含自己,因此其真...
分类:
其他好文 时间:
2015-02-12 16:23:39
阅读次数:
210
1、错误描述
java.sql.SQLException:Column Index out of range,0
2、错误原因
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection conn = null;
Statement stat = null;
ResultSet rs = null;
try
{...
分类:
数据库 时间:
2015-02-11 21:58:43
阅读次数:
177
absolute : to specify an absolute time for a time-range (in time-range configuration mode)no absolutebuffer-length : to specify the maximum length of ...
分类:
移动开发 时间:
2015-02-11 21:50:24
阅读次数:
247
标题:Integer to Roman通过率:34.4%难度:中等Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.前面做过数字转罗马数字...
分类:
其他好文 时间:
2015-02-11 16:04:41
阅读次数:
143
提示错误:UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 240: ordinal not in range(128)大概就是这样一句话,一般情况,在文件头加上 :# coding=utf-8 就应该可以解决的...
分类:
编程语言 时间:
2015-02-11 10:52:11
阅读次数:
180
1. 用python乱序一个数组:1 >>> from random import shuffle2 >>> y = [[j] for j in range(100)]3 >>> shuffle(y)4 >>> print y5 [[65], [39], [2], [94], [28], [63],...
分类:
编程语言 时间:
2015-02-11 10:41:33
阅读次数:
149
题意: 给出一个数组a[n](1<=a[i]<=n),可能会有重复,然后m组询问
每次询问两个数:l,r
在区间[l,r]内是否构成一个1,2,..,r-l 1的排列;
分析: 要想构成1,2….r-l 1的排列,首先要满足区间内的和sum=(1 len)*len/2
然后区间内的每个数都不一样即可,然后再开一个数组记录每个数前一次出现的位置pre,如果[l,r]内pre的最大值都小于l,...
分类:
其他好文 时间:
2015-02-10 23:17:00
阅读次数:
241
Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.public class Solution { public String int...
分类:
其他好文 时间:
2015-02-10 14:48:34
阅读次数:
131
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.class Solution {public: int romanToInt(st...
分类:
其他好文 时间:
2015-02-10 14:39:57
阅读次数:
111
1.shuffle deck of cards and draw cards
import itertools,random
deck=list(itertools.product(range(1,14),['Spade','Heart','Diamond','Club']))
random.shuffle(deck)
for i in range(5):
print deck[...
分类:
其他好文 时间:
2015-02-10 09:16:33
阅读次数:
138