As we well know, Gigel likes
to play with numbers. While playing he has noticed that some sequences of numbers
have peculiar properties. For example: he has noticed that positive integer
sequence 1, 3,
5 has the following properties:
- it is ascending
- 1>=1; 1+3>=22; 1+3+5>=32
- 1+3+5=32
While on the other hand, sequence 1,
2, 6
doesn't have all these properties because the sum of its first two elements
is less than 4. Generalizing,
Gigel has named these sequences special sequences. So, the sequence a1,
a2, .., an of positive integers is called a special
sequence of rank n if it meets
the following conditions:
Task
Gigel would like you to write a program that generates special sequences of
a given rank.
Input Data
Input file sir.in will contain
a single line with a positive integer n
which is the rank of the special sequences that will be generated.
Output
Data
Output file sir.out contains
on each line a special sequence of rank n.
Each sequences is written on one line, with its elements separated by a space.
The sequences are going to be generated in lexico-graphical order. If the total
number of sequences that will have to be written is more than 40 they won't
all be written; only the first 20 and afterwards the last 20 will be written.
Restrictions
1<=n<=30
Examples
sir.in |
sir.out | sir.in | sir.out |
3 | 1 3 5 1 4 4 2 2 5 2 3 4 3 3 3 |
5 | 1 3 5 7 9 1 3 5 8 8 1 3 6 6 9 1 3 6 7 8 1 3 7 7 7 1 4 4 7 9 1 4 4 8 8 1 4 5 6 9 1 4 5 7 8 1 4 6 6 8 1 4 6 7 7 1 5 5 5 9 1 5 5 6 8 1 5 5 7 7 1 5 6 6 7 1 6 6 6 6 2 2 5 7 9 2 2 5 8 8 2 2 6 6 9 2 2 6 7 8 3 3 4 7 8 3 3 5 5 9 3 3 5 6 8 3 3 5 7 7 3 3 6 6 7 3 4 4 5 9 3 4 4 6 8 3 4 4 7 7 3 4 5 5 8 3 4 5 6 7 3 4 6 6 6 3 5 5 5 7 3 5 5 6 6 4 4 4 4 9 4 4 4 5 8 4 4 4 6 7 4 4 5 5 7 4 4 5 6 6 4 5 5 5 6 5 5 5 5 5 |
Time limit:
0.1 seconds
Marinel Serban
"Gr. C. Moisil" Iaşi IT High School
marinel_serban@yahoo.com