You have infinite cards for each number between $$1$$ and $$N$$ (inclusive of them). Your task is to select three integers such that after sorting them in ascending order, the difference between the adjacent number is less than or equal to two. Find the number of ways to choose three numbers and print them.
Note: The order of numbers does not matter.
Input format
- The first line contains an integer $$T$$ denoting the number of test cases.
- For each test case, the first and only line contains an integer $$N$$.
Output format
Print $$T$$ lines, one for each test case, denoting the number of ways.
Constraints
\(1 \leq T \leq 20000\)
\(1 \leq N \leq 200000\)
For N=1 there is only one way:
- (1,1,1)
For N=3
- (1,1,1)
- (2,2,2)
- (3,3,3)
- (1,2,3)
- (1,1,3)
- (1,1,2)
- (1,2,2)
- (2,2,3)
- (1,3,3)
- (2,3,3)
These are the 10 possible ways.
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