摘要: Multi-bit Trie 题意:将长度为n(n <= 64)的序列分成若干段,每段的数字个数不超过20,且每段的内存定义为段首的值乘以2^(段的长度);问这段序列总的内存最小为多少? 思路:区间的最值,区间DP; 枚举长度,在初始化时,将长度和20比较,小于20看成是一段,大于20时,因为不能压 阅读全文
posted @ 2016-03-01 22:53 hxer 阅读(400) 评论(0) 推荐(0) 编辑
摘要: Lucas定理:用于计算组合数模除素数后的值,其实就是把(n,m)分别表示为p进制,累乘各位的可能取的个数,得到最终的结果; 推论:(n & m) == m则C(n,m)为奇数;即C(n,m) %2 = 1,即m二进制的每一位n都必须为1,所以n & m = m; 应用: Xiao Ming's H 阅读全文
posted @ 2016-03-01 20:39 hxer 阅读(243) 评论(0) 推荐(0) 编辑
摘要: DP? Problem Description Figure 1 shows the Yang Hui Triangle. We number the row from top to bottom 0,1,2,…and the column from left to right 0,1,2,….If 阅读全文
posted @ 2016-03-01 17:39 hxer 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 1. 1000以内的较多组合数求解;利用C(n,m) = C(n-1,m) + C(n-1,m-1)递推求解; const int N = 1005; ll f[N][N]; void init(int n) { f[0][0] = 1; for(int i = 1;i <= n;i++){ f[i 阅读全文
posted @ 2016-03-01 00:38 hxer 阅读(412) 评论(0) 推荐(0) 编辑