CF1419B.Stairs

普及/提高-

通过率:0%

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.

Staircase is a squared figure that consists of square cells. Each staircase consists of an arbitrary number of stairs. If a staircase has nn stairs, then it is made of nn columns, the first column is 11 cell high, the second column is 22 cells high, \ldots , the nn -th column if nn cells high. The lowest cells of all stairs must be in the same row.

A staircase with nn stairs is called nice, if it may be covered by nn disjoint squares made of cells. All squares should fully consist of cells of a staircase.

This is how a nice covered staircase with 77 stairs looks like: Find out the maximal number of different nice staircases, that can be built, using no more than xx cells, in total. No cell can be used more than once.

输入格式

The first line contains a single integer tt (1t1000)(1 \le t \le 1000) — the number of test cases.

The description of each test case contains a single integer xx (1x1018)(1 \le x \le 10^{18}) — the number of cells for building staircases.

输出格式

For each test case output a single integer — the number of different nice staircases, that can be built, using not more than xx cells, in total.

输入输出样例

  • 输入#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 11 stair. It's nice. That's why the answer is 11 .

In the second test case, it is possible to build two different nice staircases: one consists of 11 stair, and another consists of 33 stairs. This will cost 77 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 22 .

In the third test case, it is possible to build only one of two nice staircases: with 11 stair or with 33 stairs. In the first case, there will be 55 cells left, that may be used only to build a staircase with 22 stairs. This staircase is not nice, and Jett only builds nice staircases. That's why in this case the answer is 11 . If Jett builds a staircase with 33 stairs, then there are no more cells left, so the answer is 11 again.

首页