Dcoder icon

Wrestling Championship @ Dcoder

By Lochard | As a newbie programmer | 31 Jul 2023


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)

How do you rate this article?

2


Lochard
Lochard

20240228 Arrived in the UK for about 2 week. All my fears persist. Some are even getting worse. https://github.com/locharp/asylum_diary/


As a newbie programmer
As a newbie programmer

Sharing entry level codes. My snippets on GitHub https://github.com/locharp/code-snippets

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.