A robot's initial position is \((0, 0)\) and it can only move along X-axis. It has \(N\) moves to make and in each move, it will select one of the following options:
- Go to \((X-1,0)\) from \((X,0)\)
- Go to \((X+1,0)\) from \((X,0)\)
- Remain at its current position
Your task is to calculate \(\sum ( abs(X)+abs(Y))\) for all reachable \((X,Y)\).
Note: Here, \(abs\) denotes the absolute value.
See the sample explanation for better understanding.
Input format
- The first line contains \(T\) denoting the number of test cases.
- The first line of each test case containing an integer \(N\) denoting the number of moves.
Output format
Print \(T\) lines. For each test case, print a single integer as described in the problem statement.
Constraints
\(1 \leq T \leq 20000\)
\(1 \leq N \leq 1e9\)
1 1
2
He is initially at (0,0). He has 1 move to make, the positions where he can end up are (-1,0),(1,0) and (0,0).
\(\sum ( abs(x)+abs(y))\)
=abs(-1)+abs(0)+abs(1)+abs(0)+abs(0)+abs(0)
=1+0+1+0+0+0
=2
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor