Given a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.For exampl...
分类:
其他好文 时间:
2015-07-26 20:47:19
阅读次数:
107
题意:区间最大长度为1000000, 三种操作: 区间求和; 区间求最大值; 将节点值更新为当前值与给定值中的最小值(有趣的更新);思路: 暴力线段树。关键在于处理标记,需要维护最大标记,标记覆盖范围,所在区间; 覆盖区域标记起到很关键的作用;#include#i...
分类:
其他好文 时间:
2015-07-26 20:43:26
阅读次数:
179
Submit Status Practice POJ 2559Description A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles...
分类:
其他好文 时间:
2015-07-26 20:42:33
阅读次数:
122
DescriptionA number sequence is defined as follows:f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.Given A, B, and n, you are to calcul...
分类:
其他好文 时间:
2015-07-26 20:35:03
阅读次数:
78
DescriptionA histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have ...
分类:
其他好文 时间:
2015-07-26 19:13:08
阅读次数:
109
DNA SortingProblem DescriptionOne measure of ``unsortedness'' in a sequence is the number of pairs of entries that are out of order wit...
分类:
其他好文 时间:
2015-07-26 17:08:12
阅读次数:
179
问题描述Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.F...
分类:
其他好文 时间:
2015-07-26 17:01:39
阅读次数:
89
题意:
给你一个n和一个r,求Y序列的第N项是多少。
所谓的Y序列就是,从1开始,去掉能表示成a^b(2
例如r=2
序列就是:2,3,5,6,7,8,10,11,12,13,14,15,17....
思路:
我们应该能想到需要一个函数fun(x) 求的是1~x内在Y序列里的数有多少个
这个其实不难,我们可以运用容斥原理,通过63以内的素数进行计算,并且最多做三遍,因为2*3*5*7...
分类:
其他好文 时间:
2015-07-26 15:51:00
阅读次数:
130
题意:t组数据,每组数据给个m,问m最少能由几项形如3*n*(n-1)+1的数表示
eg 7=1(n=1)+1(n=1)+1(n=1)+1(n=1)+1(n=1)+1(n=1)+1(n=1);
7=7(n=2);
所以7最少能由1个数表示
分析:3*n*(n-1)+1可以转换为6*(n*(n-1)/2)+1,而n*(n-1)/2是一个三角形数,设为An,
...
分类:
其他好文 时间:
2015-07-26 15:47:31
阅读次数:
75
//0 a b 将[a,b]区间的所有数变为0
//1 a b 将[a,b]区间的所有数都变为1
//2 a b 将[a,b]区间的所有数0变1,1变0
//3 a b 问[a,b]区间的1的个数
//4 a b 问[a,b]区间最长的连续1的子段长度
//维护ma_l[2] , ma_r[2] , ma[2] ,sum[2]分别为区间左边,右边,最大的连续1和0,,区间1和0的个数
//lazy...
分类:
其他好文 时间:
2015-07-26 14:16:30
阅读次数:
105