Wrestling Championship @ Dcoder

Problem: Hulk is participating in a wrestling championship. The contest consists of N fighters including Hulk. The contest is of several stages. At each stage, if number of fighters are X, then there are X/2 fights and X/2 fighters move on to the next sage. Since, Hulk is hungry, he can't wait for contest to be over. He has asked you to calculate the number of hours he'll have to wait for contest to be over if each fight is of 1 hour each.
Note-- Initial number of fighters will always be a power of 2, i.e., N = 2^x, where x is a positive integer.

Input: First line consists of T, number of test cases.
Each of the next T lines consists of single integer N, number of initial fighters.

Output: For each test case, print one integer denoting the time in hours.

Constraints: 1 <= T <= 10
1 <= N <= 10^9
Sample Input: 2
8
16
Sample Output:
7
15

for i in range(int(input())):
  print(int(input()) - 1)
H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center