当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2309:BST

题目描述
Consider an infinite full binary search tree (see the figure below), the numbers in the nodes are 1, 2, 3, .... In a subtree whose root node is X, we can get the minimum number in this subtree by repeating going down the left node until the last level, and we can also find the maximum number by going down the right node. Now you are given some queries as "What are the minimum and maximum numbers in the subtree whose root node is X?" Please try to find answers for there queries.
输入解释
In the input, the first line contains an integer N, which represents the number of queries. In the next N lines, each contains a number representing a subtree with root number X (1 <= X <= 231 - 1).
输出解释
There are N lines in total, the i-th of which contains the answer for the i-th query.
输入样例
2
8
10
输出样例
1 15
9 11

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 POJ Monthly,Minkerui

源链接: POJ-2309

最后修改于 2020-10-29T06:29:22+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536