409873: GYM103821 E Robovac

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

E. Robovactime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Edrisov likes to keep his house clean, but knowing that the exams are around the corner, he doesn't have a lot of free time, so he decided it's time to buy a robovac!

Robovac is a short name for robot vaccum cleaner, which -given it's name- does the cleaning automatically.

Edrisov lives inside a line divided into $$$N$$$ cells. Initially the robot is standing on the middle cell (cell with index $$$\lceil \frac {N}{2} \rceil$$$) and faces the right direction (direction of the $$$N_{th}$$$ cell), the robot will keep moving in some direction until it steps on a cell it hasn't visited yet, then it will change direction and repeat the process.

The robot will stop moving when all cells are visited. (see notes for a better understanding on how the robot is moving).

Can you help Edrisov to know how many steps the robot will make during the cleaning process?

Input

Each test contains multiple test cases. The first line contains the number of test cases $$$T$$$ ($$$1 \le T \le 10^5$$$). Description of the test cases follows.

Each of the following $$$T$$$ lines, contains a single integer $$$N$$$ ($$$1\le{N}\le{10}^9$$$) — Number of cells in the line.

Output

For each test case, output a single integer denoting the answer for the $$$i_{th}$$$ test case.

ExampleInput
2
3
4
Output
3
6
Note

for $$$N=4$$$, the robot starts at cell with index $$$2$$$ and faces the right direction:

  • in the first step it will visit the $$$3_{rd}$$$ cell, which has not been visited before so the robot will change direction to the left.
  • in the second step the robot will revisit the $$$2_{nd}$$$ cell, so it will keep moving to the left.
  • in the third step the robot will visit the first cell which hasn't been visited yet, so the robot will change direction to the right.
  • the robot will keep moving to the right and stops moving when it reaches the $$$4_{th}$$$ cell, hence the the answer is 6 steps.

加入题单

上一题 下一题 算法标签: