Recursion
Recursion-15
Recursion-16
Recursion-17
~/algor $ cat problems/rekursiya-ikkilik-satrlar
Binary strings with k ones
Easy
1000 ms
128 MB
33%
You are given integers $n$ and $k$. Print in lexicographic order (the character 0 comes before 1) all strings of length $n$ made of the characters 0 and 1 that contain exactly $k$ ones 1.
Input
One line with two integers: $n$ and $k$.
Output
Each string on its own line, in lexicographic order.
Note
$1 \le n \le 16$
$0 \le k \le n \le 16$
Examples
Input #1
3 1
Output #1
001 010 100
Input #2
4 2
Output #2
0011 0101 0110 1001 1010 1100