摘要: 转化一下模型:每天可以选1也可以选0,但是任意前i天(i<=n)1的个数都必须>=0的个数,求总方案数/2^n。 然后可以发现这是一个经典题,随便推一下公式发现等于 C(n,n/2)/2^n [请在二维平面直角坐标系上自行演算,(x,y)可以到 (x+1,y)和(x,y+1),横坐标代表1的个数,纵 阅读全文
posted @ 2018-05-01 20:09 蒟蒻JHY 阅读(176) 评论(0) 推荐(0) 编辑
摘要: Discription Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other an 阅读全文
posted @ 2018-05-01 18:50 蒟蒻JHY 阅读(203) 评论(0) 推荐(0) 编辑
摘要: Discription The Little Elephant loves permutations of integers from 1 to n very much. But most of all he loves sorting them. To sort a permutation, th 阅读全文
posted @ 2018-05-01 16:48 蒟蒻JHY 阅读(229) 评论(0) 推荐(0) 编辑
摘要: 大意就是给你一颗树,每个点有一个权值w[i],求一个排列使得 所有的父亲都在儿子前面 并且排列的权值最小。 排列的权值在这里定义为 Σ i * w[p[i]] ,其中p[i] 是排列第i个位置的元素。 然后我瞎jb胡了一个算法,对于每个子树维护一个 p[],表示只考虑子树内的元素的最优排列。显然我们 阅读全文
posted @ 2018-05-01 10:31 蒟蒻JHY 阅读(368) 评论(0) 推荐(0) 编辑