Description 给n个数,从中任意选出一些数,使这些数能分成和相等的两组。 求有多少种选数的方案。 Input 第$1$行:一个整数$N$ 第$2$到$N+1$行,包含一个整数$m_i$ Output 一行:平衡的集合的个数. 看到题的一瞬间数据范围? $N \leq 20?$状压! 明显直 ...
分类:
其他好文 时间:
2018-10-21 21:59:31
阅读次数:
285
CF873B Balanced Substring (前缀和) 蛮有意思的一道题,不过还是.....................因为CF评测坏了,没有试过是否可过. 显然求$\sum[i][0] \sum[l][0] = \sum[i][1] \sum[l][1]$ $\sum[i][0] \s ...
分类:
其他好文 时间:
2018-10-16 22:02:27
阅读次数:
175
T1 (折半搜索) 题意: 给定一个序列,求有多少个非空子集,能划分成和相等的两份。 即[Usaco2012 Open]Balanced Cow Subsets; 数据范围n<=20,mi<=1e8,测试时打了个暴搜过了60分, 转化一下模型能知道对于每个数来说只会有3种情况, 1、没有被选; 2、 ...
分类:
其他好文 时间:
2018-10-16 17:42:51
阅读次数:
149
题目描述 Farmer John's N cows (1 <= N <= 100,000) are lined up in a row. Each cow is identified by an integer "breed ID" in the range 0...1,000,000,000; t ...
分类:
其他好文 时间:
2018-10-14 00:26:24
阅读次数:
153
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced binary tree is d ...
分类:
其他好文 时间:
2018-10-11 18:53:13
阅读次数:
121
题目传送门 Balanced Number Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 7994 Accepted Submission(s ...
分类:
其他好文 时间:
2018-10-08 23:10:31
阅读次数:
140
题意: 给出范围 算出 满足 选取一个数中任一一个 树作为支点 两边的数分别乘以到中心的距离和 左和等于右和 的数有多少个 数位DP题 状态转移方程为dp[pos][x][state]=dp[pos-1][x][state-(pos-x)*i] 表示为pos位上的数字为 i 以x为支点 则 以中心点 ...
分类:
其他好文 时间:
2018-10-07 00:02:30
阅读次数:
187
一、题目 1、审题 2、分析 给出一棵二叉树,判断其是否是一棵二叉平衡树。 二、解答 1、思路: 方法一、 采用递归; 每次获取 root 结点的左子树、右子树的高度,比较高度差是否小于等于 1; 同时判断左子树、右子树是否也是二叉平衡树。 方法二、 采用深度优先遍历的方式获取深度,并且获取时比较该 ...
分类:
其他好文 时间:
2018-10-01 17:13:19
阅读次数:
180
Balanced numbers have been used by mathematicians for centuries. A positive integer is considered a balanced number if: 1) Every even digit appears an ...
分类:
其他好文 时间:
2018-09-29 20:30:52
阅读次数:
225
Description N(1 two total Feature 2: 1 1 0 0 two total Feature 1: 1 0 1 0 two total Key: 7 2 1 4 Cow : 3 4 5 6 这题我们推推柿子,我们首先记录一下前缀和 sum "i][k],表示到第i头牛 ...
分类:
其他好文 时间:
2018-09-27 20:41:35
阅读次数:
209