22314_Collatz

2022-5-16 18:21| 发布者: Hocassian| 查看: 15| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506314526499-Problem List-采集的数据-后羿采集器.html

Pro.ID

22314

Title

Collatz

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22314

AC

13

Submit

33

Ratio

39.39%

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    In the process to solve the Collatz conjecture, better known as the 3n + 1 problem, Carl created a physical model with wood and ropes. A wooden bar contains a hole for every natural number from 1 to infinity from left to right. For every even number m there is a rope connecting the m-th hole with hole m/2 . For every odd number n there is a rope connecting the nth hole with hole 3n + 1.

    For an important conference where Carl plans to elaborate on his results, he wants to bring his structure, but it is too large to fit in his bag. So he decided to saw off the part of the bar containing the first N holes only. How many ropes will he need to cut?

    输入

    The first line of the input contains a single number: the number of test cases to follow. Each test case has the following format:

    One line with an integer N, satisfying 0 ≤ N ≤ 109.

    输出

    Description

    In the process to solve the Collatz conjecture, better known as the 3n + 1 problem, Carl created a physical model with wood and ropes. A wooden bar contains a hole for every natural number from 1 to infinity from left to right. For every even number m there is a rope connecting the m-th hole with hole m/2 . For every odd number n there is a rope connecting the nth hole with hole 3n + 1.

    For an important conference where Carl plans to elaborate on his results, he wants to bring his structure, but it is too large to fit in his bag. So he decided to saw off the part of the bar containing the first N holes only. How many ropes will he need to cut?

    Input

    The first line of the input contains a single number: the number of test cases to follow. Each test case has the following format:

    One line with an integer N, satisfying 0 ≤ N ≤ 109.

    Output

    For every test case in the input, the output should contain a single number, on a single line: the number of ropes that need to be cut.

    Sample Input

    3
    12
    240
    3600

    Sample Output

    10
    200
    3000

    Source

    样例输入

    3
    12
    240
    3600

    样例输出

    10
    200
    3000

    提示

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部