枚举支点之后数位DP,注意姿势#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace st...
分类:
其他好文 时间:
2014-08-02 18:11:43
阅读次数:
301
/*sum[root][i]表示root节点的子叶子%3余i的总数 lazy懒惰标记*/ 1 #include 2 #include 3 using namespace std; 4 #define N 400010 5 int sum[N][3],lazy[N]; 6 void pushup(.....
分类:
其他好文 时间:
2014-08-02 17:51:03
阅读次数:
270
题目大意:
给出一个递推的关系。
这个递推的关系可以求出 s_1 s_2 s_3 .... s_m
然后再告诉一个 k 与 n
求出segma( s_k , s_2*k , s_3*k)...共n项。
思路分析:
首先给出来的是递推关系式。
所以可以用一个矩阵递推出 s [i]...
但是他要的是每隔k的值。
定义s的递推矩阵是 A
SUM = S_k + S_2*...
分类:
其他好文 时间:
2014-08-02 12:49:03
阅读次数:
219
Playground
Time limit:
2s
Source limit:
50000B
Memory limit:
256MB
My kid's school cleared a large field on their property recently to convert it into a play...
分类:
其他好文 时间:
2014-08-01 19:43:32
阅读次数:
328
Dividing Stones
Time limit:
7s
Source limit:
50000B
Memory limit:
256MB
There are N stones, which can be divided into some piles arbitrarily. Let the v...
分类:
其他好文 时间:
2014-08-01 19:42:12
阅读次数:
261
题目:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.题解:之前做过一道是从sorted array转换到BinarySearc....
分类:
编程语言 时间:
2014-08-01 04:54:21
阅读次数:
310
Balanced Binary TreeGiven a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tre...
分类:
其他好文 时间:
2014-07-31 23:20:20
阅读次数:
267
Convert Sorted Array to Binary Search TreeGiven an array where elements are sorted in ascending order, convert it to a height balanced BST.算法:根据有序数组,生...
分类:
其他好文 时间:
2014-07-31 23:20:00
阅读次数:
270
Given a binary tree, determine if it is height-balanced.
For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never diffe...
分类:
编程语言 时间:
2014-07-31 20:55:47
阅读次数:
197
题目:Given an array where elements are sorted in ascending order, convert it to a height balanced BST.题解:先复习下什么是二叉搜索树(引自Wikipedia):二叉查找树(Binary Search ....
分类:
编程语言 时间:
2014-07-31 05:21:55
阅读次数:
215