Combinations 1
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
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.
Examples
Input #1
Answer #1
Submissions 331
Acceptance rate 31%