CF1419B.Stairs
普及-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Jett is tired after destroying the town and she wants to have a rest. She likes high places, that's why for having a rest she wants to get high and she decided to craft staircases.
A staircase is a squared figure that consists of square cells. Each staircase consists of an arbitrary number of stairs. If a staircase has n stairs, then it is made of n columns, the first column is 1 cell high, the second column is 2 cells high, …, the n-th column if n cells high. The lowest cells of all stairs must be in the same row.
A staircase with n stairs is called nice, if it may be covered by n disjoint squares made of cells. All squares should fully consist of cells of a staircase.
This is how a nice covered staircase with 7 stairs looks like: 
Find out the maximal number of different nice staircases, that can be built, using no more than x cells, in total. No cell can be used more than once.
杰特在摧毁城镇后感到疲惫,她想休息一下。她喜欢高处,因此为了休息,她想爬得高一些,于是决定建造楼梯。
楼梯是一种由正方形格子组成的正方形图形。每个楼梯由任意数量的台阶组成。如果一个楼梯有 n 个台阶,则它由 n 列组成:第一列高 1 格,第二列高 2 格,……,第 n 列高 n 格。所有台阶的最底层格子必须位于同一行。
若一个含 n 个台阶的楼梯能被 n 个互不相交的、完全由该楼梯内格子构成的正方形所覆盖,则称其为“优美的”。
下图展示了一个含 7 个台阶的、被覆盖的优美楼梯: 
求:在总共至多使用 x 个格子(每个格子至多使用一次)的前提下,最多能建造多少个互不相同的优美楼梯?
输入格式
The first line contains a single integer t (1≤t≤1000) — the number of test cases.
The description of each test case contains a single integer x (1≤x≤1018) — the number of cells for building staircases.
第一行包含一个整数 t(1≤t≤1000)—— 测试用例的数量。
每个测试用例的描述包含一个整数 x(1≤x≤1018)—— 用于建造楼梯的单元格数量。
输出格式
For each test case output a single integer — the number of different nice staircases, that can be built, using not more than x cells, in total.
对于每个测试用例,输出一个整数——即使用总计不超过 x 个单元格所能构建的不同“优美楼梯”的数量。
输入输出样例
输入#1
4 1 8 6 1000000000000000000
输出#1
1 2 1 30
说明/提示
In the first test case, it is possible to build only one staircase, that consists of 1 stair. It's nice. That's why the answer is 1.
In the second test case, it is possible to build two different nice staircases: one consists of 1 stair, and another consists of 3 stairs. This will cost 7 cells. In this case, there is one cell left, but it is not possible to use it for building any nice staircases, that have not been built yet. That's why the answer is 2.
In the third test case, it is possible to build only one of two nice staircases: with 1 stair or with 3 stairs. In the first case, there will be 5 cells left, that may be used only to build a staircase with 2 stairs. This staircase is not nice, and Jett only builds nice staircases. That's why in this case the answer is 1. If Jett builds a staircase with 3 stairs, then there are no more cells left, so the answer is 1 again.
在第一个测试用例中,只能建造一个由 1 级台阶组成的楼梯。它是“优美的”。因此答案为 1。
在第二个测试用例中,可以建造两个不同的优美楼梯:一个由 1 级台阶组成,另一个由 3 级台阶组成。这将消耗 7 个格子。此时还剩余 1 个格子,但无法用它来建造任何尚未建造过的优美楼梯。因此答案为 2。
在第三个测试用例中,只能在两个优美楼梯(即由 1 级台阶组成的楼梯或由 3 级台阶组成的楼梯)中选择建造其中一个。若选择建造由 1 级台阶组成的楼梯,则将剩余 5 个格子;这些格子仅够建造一个由 2 级台阶组成的楼梯,但该楼梯不是优美的,而 Jett 只建造优美楼梯。因此该情况下的答案为 1。若 Jett 改为建造由 3 级台阶组成的楼梯,则不再剩余任何格子,答案仍为 1。
输入解题思路,AI测评打分。不知道怎么写?