比赛链接:[AGC005][9] C. Tree Restoring 题意 给出树上每个节点到其它节点的最远距离,问是否可能。 $ n ≤ 100 $ 。 题解 离一个点最远的节点是直径两端点之一。 先把直径上的点切出来。剩余的点判断一下是不是在 $ \lceil \frac{d}{2} \rcei ...
分类:
其他好文 时间:
2019-10-24 09:22:03
阅读次数:
83
传送门 首先可以证明一颗树合法的充分必要条件是不存在某个节点的度数为 $2$ 首先它是必要的,考虑任意一条边连接的两点如果存在某一点 $x$ 度数为 $2$ ,那么说明 $x$ 还有连一条边出去,那么连出去的那一条边和当前边的权值就永远一样 然后它是充分的,考虑进行如下操作:首先设当前边连接的两端分 ...
分类:
其他好文 时间:
2019-10-23 22:04:33
阅读次数:
78
Booth's multiplication algorithm is a multiplication algorithm that multiplies two signed binary numbers in two's complement notation. The algorithm w ...
分类:
其他好文 时间:
2019-10-23 22:03:59
阅读次数:
98
题面 首先发现:一个数最多会出现1次; 然后深入推出:一个数不会既用它又用它的相反数; 这样就可以依次考虑每一位了: 如果所有的数都不含有这一位,那么就直接把所有的数除以2 如果含有,那么就减去这一位的数,再除以2; 2 当含有的时候搜索就可以了; 注意需通过去重来优化dfs,否则会TLE掉; ...
分类:
其他好文 时间:
2019-10-23 19:47:45
阅读次数:
52
算法对比二叉树当我查找8的时候需要走五步红黑树当我查询8的时候需要四次相对于二叉树有了一些优化没有无限延伸.红黑树的深度会很深(深度不可控制)hash数据量大的话查询很快(不能范围查找)BTree查询只需要查两步就可以找到,缺点携带(data)扩大横向减少纵向深度ps:java拿取数据一般是这样的:java程序-->CPU--->内存---->硬盘,而内存与硬盘的交互是有大小限制
分类:
数据库 时间:
2019-10-23 18:22:53
阅读次数:
130
"洛咕" 题意:给定一棵$n(n include include include include include include include define ll long long using namespace std; inline int read(){ int x=0,o=1;char ...
分类:
其他好文 时间:
2019-10-23 15:22:32
阅读次数:
94
Problem Description Consider a un-rooted tree T which is not the biological significance of tree or plant, but a tree as an undirected graph in graph ...
分类:
其他好文 时间:
2019-10-23 13:38:00
阅读次数:
71
Given a binary tree, flatten it to a linked list in-place. For example, given the following tree: The flattened tree should look like: ...
分类:
其他好文 时间:
2019-10-23 12:06:42
阅读次数:
102
以下使用共享内存的模块如下: 共享内存都需要全局锁 1:目前nginx用的锁是自旋锁 2:nginx共享内存都基本用到了rbtree数据结构 ...
分类:
系统相关 时间:
2019-10-23 09:39:52
阅读次数:
81