P1049 Brutus, Frutus and partitions
What did Brutus and Frutus discussed? They quarrelled about what the tenth partition of number 10 in the Nice Order was. The partition is any decomposition of the number to the positive integer addends which are ordered in the nonincreasing order (e.g. 10=6+3+1). The order, in which partition a_1+a_2+...+a_k comes before b_1+b_2+...+b_l if and only if for some u:
a_1=b_1, a_2=b_2, ..., a_u=b_u , a_{u+1}>b_{u+1},
we call the Nice Order.
For example the partitions of the number 6 listed in the Nice Order are: 6, 5+1, 4+2, 4+1+1, 3+3, 3+2+1, 3+1+1+1, 2+2+2, 2+2+1+1, 2+1+1+1+1, 1+1+1+1+1+1
Problem: Write a program which reads the numbers n and k and as an input and writes the kth partition of the number n in the Nice Order as an output.
Note: In this case Frutus was right.