Description
Tree Recovery
Little Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with capital letters i...
分类:
其他好文 时间:
2014-07-17 17:21:38
阅读次数:
253
big-endian vs little-endian
分类:
其他好文 时间:
2014-07-16 22:55:10
阅读次数:
227
题意为F束花插入V个瓶子里面,花要按编号递增顺序插,不同花插入不同的花瓶有不同的美观程度,要求最大的美观程度。一种f[i][j]表示第i束花插入第[j]个瓶子里面所获得的最大的美观程度。则状态转移函数可以表示为f[i][j]=max(f[i-1][k]+a[i][j])其中i-1#include #...
分类:
其他好文 时间:
2014-07-13 23:50:22
阅读次数:
323
时间限制:0.75s空间限制:6M题意 n*n(n>1; r同理,即rint n, sum, max, k, m;void dfs (int line , int row, int l, int r, int k) { int pos, p, i; if (line > n){ ...
分类:
其他好文 时间:
2014-07-11 17:59:56
阅读次数:
358
题目大意:
说七个party选择数字(各不相同)
而规定的小象的party选择的数字之中所拥有的数字4和7的个数要比其他六个party拥有的个数之和还要严格多,询问方案数。
如m=7时其余的随意选择至少会拥有一个4或7,与题意矛盾,故方案数为0
m=8时,7 1 2 3 5 6 8是一种合法方案
思路:
由于小象的party选到的数字所含4和7的个数至多和m的位数一样多,则枚举小象的party所含4和7的个数,剩余的6个party直接用dfs即可(直接用乘法原理)。
而通过数位dp可以算出1~m之中所拥有...
分类:
其他好文 时间:
2014-07-10 19:44:26
阅读次数:
193
假设n=3
构造矩阵【1,0,0,0】
对于g 1操作,构造矩阵(0行i列++)
1 1 0 0
0 1 0 0
0 0 1 0
0 0 0 1
对于e 1操作,构造矩阵 (i整列清空)
1 0 0 0
0 0 0 0
0 0 1 0
0 0 0 1
对于s 1 2操作,构造矩阵 (i,j整列交换)
1 0 0 0
0 0 1 0
0 1
0 0
0 0...
分类:
其他好文 时间:
2014-07-10 19:37:51
阅读次数:
204
Little BishopsA bishop is a piece used in the game of chess which is played on a board of square grids. A bishop can only move diagonally from its cur...
分类:
其他好文 时间:
2014-07-09 23:05:17
阅读次数:
252
时间限制:0.25s空间限制:4M题意: 在 n*n(n≤10)的棋盘上放 k (k#include #define LL long longusing namespace std;int powT[11];int statu[1 > 1) ) == 0) && ( (i & (i 0; t ...
分类:
其他好文 时间:
2014-07-09 13:43:57
阅读次数:
168
POJ 3735 Training little cats 矩阵快速幂 矩阵构造...
分类:
其他好文 时间:
2014-07-08 17:58:52
阅读次数:
172
;; Fermat's Little Theorem:
;; If N is a prime number and A is any positive integer less
;; than N, then A raised to the N-th power is congruent to A modulo N
;; Two numbers are said to be congruent...
分类:
其他好文 时间:
2014-07-06 09:05:22
阅读次数:
158