LUFA cup 2024
Time Limit: 1.0 s
Memory Limit: 256.0 MB
Description
The president of LUFA (Leading university football association) has announced a football tournament named "LUFA cup 2024". He wants to make the tournament as much big as possible. Thats why he is going to arrange the tournament in a way that maximum number of matches will be played. As we know that a tournament cannot be played for an infinite time so he came up with the following rules:
In the first round each of the N team will face every other (N-1) team once. At least one team will be eliminated from the first round according to the point table standings.
All other rounds except first round will be played in knockout format. That means in a round each team will play only one match and exactly half of the teams will go to the next round.
Now, the president of LUFA is asking you to write a program to calculate the maximum number of matches possible in the whole tournament for N teams according to the rules mentioned above. Can you do it ?
Input
First line of input takes an integer T: number of testcases
Each of the next T lines takes an integer N: number of teams in the tournament
1 <= \(T\) <= 10^4
1 <= \(N\) <= 10^9
Output
print T lines, each line should contain an integer : The maximum number of matches possible in the tournament for N team.
Sample
Input | Output |
---|---|
|
|
in the first testcase, to its not possible to arrange a match with only one team.
in the second testcase, one team will be eleminated from the first round and remaining two team will play the final. In the first round 3 matches will be played.
in the third testcase, two team will be eleminated from the first round and remaining two will play the final.
Information
- ID
- 1026
- Difficulty
- 7
- Category
- (None)
- Tags
- (None)
- # Submissions
- 27
- Accepted
- 6
- Accepted Ratio
- 22%
- Uploaded By
Related
In following contests: