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

建议使用的浏览器:

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

7100:Cut The Wire

题目描述
In the country of Infinity , there is a strange road. This road only has a starting point, but no end. Since this road is infinite, there are also countless street lights. The street lights are numbered from $1$(the starting point) to infinity. The street lights are connected by wires under a strange law:

For a street light $x$,


  • if $x$ is even, then $x$ is connected with $\frac{x}{2}$ by a wire;


  • if $x$ is odd, then $x$ and $3x + 1$ is connected by a wire.



Now Kris is standing in the middle of street light $n$ and $n + 1$, and he is able to cut all wires passing by. That is, he will cut all wires connecting street lights $a$ and $b$ satisfying $a \leq n$ and $b > n$.

Now he wonders, how many wires he will cut. Please help him calculate.
输入解释
This problem contains multiple test cases.

The first line contains an integer $T(1 \leq T \leq 10 ^ 5)$ indicating the number of test cases.

The next $T$ lines each contains one integer $n(1 \leq n \leq 10 ^ 9)$.
输出解释
For each test case, output one line of one integer indicating the answer.
输入样例
2
12
60
输出样例
10
50

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-7100

最后修改于 2021-10-23T19:11:26+00:00 由爬虫自动更新

共提交 9

通过率 0.0%
时间上限 内存上限
2000/1000MS(Java/Others) 262144/262144K(Java/Others)