2554. Weighing

单点时限: 2.0 sec

内存限制: 256 MB

Suppose you have a physical balance(the kind where you can place weights on b1oth sides ) lets say you have weights 1,2 and 5. Using these weights you can measure all 1,2,3,4,5,6,7,8 kg weights where we measure 4 = 5-1 i.e. you place 5 kg weight on one side and 1 kg weight on the side where the thing to be weighed is kept. Now you can measure all weights from 1 to 8 using just 3 weights. This in fact is the least number of weights to do this. You will be given a number n as input and you have to output a number w,is least no of weights to measure all quantities weighing from 1 to n kgs.

输入格式

First Line contains an integer t,is the number of test cases

There will be t test cases following, one per line.

Each Test case input consists of one integer n < 1000000.

输出格式

For every test case, output an integer which denotes minimum number of weights required one on new line

样例

Input
2
8
10
Output
3
3

22 人解决,59 人已尝试。

28 份提交通过,共有 129 份提交。

6.4 EMB 奖励。

创建: 11 年,6 月前.

修改: 3 年,2 月前.

最后提交: 2 年,4 月前.

来源: partychen

题目标签