CCC '96 S3 - Pattern Generator
View as PDFCanadian Computing Competition: 1996 Stage 1, Senior #3
Write a program that repeatedly reads two numbers and
and prints all bit patterns of length
with
ones in descending order (when the bit patterns are considered as binary numbers). You may assume that
,
, and
. The first number in the input gives the number of pairs
and
. The numbers
and
are separated by a single space. Leading zeroes in a bit pattern should be included. See the example below.
Sample Input
3
2 1
2 0
4 2
Sample Output
The bit patterns are
10
01
The bit patterns are
00
The bit patterns are
1100
1010
1001
0110
0101
0011
Note that the grader is sensitive with spacing and new lines. Ensure that there are spaces between output cases, but no extra one for the last case. You will recieve a WA judge verdict if the spacing is incorrect.
Comments