Yet another subarray problem
Given a positive integer
, find an array of length consisting of distinct integers from to , such that the following condition is satisfied for each subarray ():
- The sum of elements in the subarray is divisible by its length i.e. is divisible by .
It can be proved that such an array always exists under given constraints.
If there are multiple possible arrays, you may print any of them.
Input Format
- The first line of the input contains a single integer , denoting the number of test cases. The description of test cases follows.
- Each test case consists of a single line containing one positive integer , the length of the array .
Output Format
For each test case, print one line containing space-separated integers, the contents of the array .
Constraints
- Sum of over all test cases doesn't exceed
Sample Input 1
3
1
2
3
Sample Output 1
1
1 3
4 2 6
Explanation
Test case :
For array ,
- The sum of elements of the subarray is equal to which is divisible by , the length of this subarray.
Test case :
For array ,
- The sum of elements of the subarray is equal to which is divisible by , the length of this subarray.
- The sum of elements of the subarray is equal to which is divisible by , the length of this subarray.
- The sum of elements of the subarray is equal to which is divisible by , the length of this subarray.
Test case :
For array ,
- The sum of elements of the subarray is equal to which is divisible by , the length of this subarray.
- The sum of elements of the subarray is equal to which is divisible by , the length of this subarray.
- The sum of elements of the subarray is equal to which is divisible by , the length of this subarray.
- The sum of elements of the subarray is equal to which is divisible by , the length of this subarray.
- The sum of elements of the subarray is equal to which is divisible by , the length of this subarray.
- The sum of elements of the subarray is equal to which is divisible by , the length of this subarray.
Comments
Post a Comment