[Solution] Average Permutation CodeChef Solution
Problem
You are given an integer .
Find a permutation of the integers such that sum of averages of all consecutive triplets is minimized, i.e.
is minimized.
If multiple permutations are possible, print any of them.
Input Format
- The first line of input will contain a single integer , denoting the number of test cases.
- The first and only line of each test case contains an integer N, the size of the permutation.
Output Format
For each test case, output on a new line a permutation which satisfies the above conditions.
Explanation:
Test case : The sum is Among all possible permutations of , this is one of the permutations which provides the minimum result.
Test case : The sum is . Every permutation of size will have this value, hence it is the minimum possible.
No comments:
Post a Comment