#C3398. Binary String Conversion
Binary String Conversion
Binary String Conversion
You are given two integers \(n\) and \(m\) and a list of \(n\) non-negative integers. Your task is to convert each integer into its binary representation with exactly \(m\) digits. If the binary form has fewer than \(m\) digits, pad it with leading zeros.
For instance, if \(n=3\), \(m=8\), and the list is [5, 18, 255], then their binary representations are ["00000101", "00010010", "11111111"].
Note: The conversion formula for a number \(x\) is given by its binary representation adjusted to a fixed length \(m\): \[ \text{binary}(x) = \text{format}(x, \text{'0'} + m + \text{'b'}) \]
inputFormat
The first line contains two integers (n) and (m) separated by a space. The second line contains (n) non-negative integers separated by spaces.
outputFormat
Output (n) lines, where each line contains the corresponding (m)-digit binary representation of the input integers in the order they were given.## sample
3 8
5 18 255
00000101
00010010
11111111
</p>