Problems
Combinations 1
Combinations 1
Given positive integers n and k, print all binary sequences of length n that contains exactly k ones in lexicographical order.
Input
Two positive integers n and k (n ≥ 1, 0 ≤ k ≤ n).
Output
Print each binary sequence on a separate line. The digits in the sequence must be separated by a single space.
Input example #1
4 2
Output example #1
0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 1 1 0 1 0 1 1 0 0