#P12188. Array Transformation Using \(\texttt{bitCount}\) Function
Array Transformation Using \(\texttt{bitCount}\) Function
Array Transformation Using (\texttt{bitCount}) Function
You are given an array \( a \) consisting of \( n \) elements \( a_1, a_2, \cdots, a_n \). You are also given an integer \( m \) representing the number of transformations to perform on the array.
In each transformation, every element \( a_i \) is updated as follows:
\[ a_i = a_i \times \text{bitCount}(a_i), \]where \( \text{bitCount}(x) \) denotes the number of \( 1 \)'s in the binary representation of \( x \). For example, \( \text{bitCount}(3) = 2 \) because the binary representation of \( 3 \) is \( 11 \), which contains two \( 1 \)'s.
Your task is to output the final state of the array after performing the \( m \) transformations.
inputFormat
The first line of input contains two integers \( n \) and \( m \), where \( n \) is the number of elements in the array and \( m \) is the number of transformations.
The second line contains \( n \) space-separated integers, representing the elements \( a_1, a_2, \dots, a_n \) of the array.
outputFormat
Output the final array after \( m \) transformations. The elements should be separated by a single space.
sample
5 1
1 3 5 7 9
1 6 10 21 18