[Solution] Construct An Array CodeChef Solution | CodeChef Problem Solution 2022
Given an integer , construct an array of length such that:
- for all ;
- There exists a subsequence of length greater than such that the gcd of all elements of the subsequence is , for all .
More formally, for all , there exists a subsequence of array such that the length of the subsequence is and .
It can be proven that it is always possible to construct such
Solution Click Below:- CLICK HERE
under given constraints. If there exist multiple such arrays, print any.
Input Format
- The first line of input contains a single integer , denoting the number of test cases. The description of test cases follow.
- The only line of each test case contains an integer - the length of the array to be constructed.
Output Format
For each test case, output a single line containing space-separated integers, denoting the elements of the array . The of these integers is the element of the array .
If there exist multiple such arrays, print any.
Constraints
- Sum of over all test cases does not exceed
No comments:
Post a Comment