"题目" 一道树状数组的裸题。 值得一提的是题目的翻译貌似有点问题。 如果L[i]和R[i]的数目相差2倍以上的话,第i头奶牛就是不平衡的。(L[i]和R[i]分别代表第i头奶牛左右两边比她高的数量)。如果L[i]和R[i]中较大者比较小者的数量严格多两倍的话,这头奶牛也是不平衡的 题目中这段话的意 ...
分类:
其他好文 时间:
2019-12-29 11:04:30
阅读次数:
66
思路: dp,使用了bitset优化。 实现: ...
分类:
其他好文 时间:
2019-12-17 18:12:04
阅读次数:
95
由polya定理$$Ans=\frac{\sum_{d|n}f(d)*\phi(\frac{n}{d})}{n}$$ $f(i)$表示不考虑旋转同构下长度为$i$的环的合法方案数。 $g(i)$表示第$i$位为男的链的方案数。 $h(i)$表示第$1$位和第$i$位都是男的链的方案数。 对于$g$数 ...
分类:
其他好文 时间:
2019-12-14 20:56:38
阅读次数:
159
链接: https://vjudge.net/problem/HDU 3709 题意: A balanced number is a non negative integer that can be balanced if a pivot is placed at some digit. More ...
分类:
其他好文 时间:
2019-12-07 01:14:03
阅读次数:
81
链接: https://vjudge.net/problem/SPOJ BALNUM 题意: Balanced numbers have been used by mathematicians for centuries. A positive integer is considered a bal ...
分类:
其他好文 时间:
2019-12-07 00:59:49
阅读次数:
78
题目链接:https://www.spoj.com/problems/COT/en/ 题意:求树上A,B两点路径上第K小的数 思路:主席树实际上是维护的一个前缀和,而前缀和不一定要出现在一个线性表上。 比如说我们从一棵树的根节点进行DFS,得到根节点到各节点的距离dist[x]——这是一个根-x路径 ...
分类:
其他好文 时间:
2019-11-28 01:37:53
阅读次数:
89
There is a kind of balanced binary search tree named red-black tree in the data structure. It has the following 5 properties: (1) Every node is either ...
分类:
其他好文 时间:
2019-11-23 21:36:27
阅读次数:
58
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 ...
分类:
其他好文 时间:
2019-11-16 21:49:38
阅读次数:
70
1234 Replace the Substring for Balanced String 替换子串等到平衡字符串 问题描述 有一个只含有 四种字符,且长度为 的字符串。 假如在该字符串中,这四个字符都恰好出现 次,那么它就是一个「平衡字符串」。 给你一个这样的字符串 ,请通过「替换一个子串」的方 ...
分类:
其他好文 时间:
2019-11-01 20:58:49
阅读次数:
135
__ "Codeforces Global Round 5" __ __ "A. Balanced Rating Changes" __ __思路:$n$为偶数 则这n个数里面奇数的个数一定为偶数 那么就每次令一个答案为$\frac{a_i}{2} 1$ 另一个答案为$\frac{a_i}{2} + ...
分类:
其他好文 时间:
2019-10-27 16:52:38
阅读次数:
60