| MNNIT CC Club |
|---|
| Private |
| Spectator |
| OPC March 2026 |
|---|
| Finished |
You are given an integer n. You have to find the maximum possible cost of a permutation of length n.
The cost of a permutation is defined as - Let [$$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$] be the permutation. Cost = |$$$a_n$$$ - $$$a_1$$$| + $$$\sum_{i = 2}^n |a_i - a_{i - 1}|$$$.
A permutation of length n is an array in which each element from 1 to n occurs exactly once.
The first line contains the number of testcases, t ($$$1$$$ <= t <= $$$10^5$$$).
The next $$$t$$$ lines contains one integer each, n ($$$2$$$ <= n <= $$$10^9$$$).
Output $$$t$$$ lines, each line containing an integer, the cost for the permutation in that testcase.
1 3
4
| Name |
|---|

