Submit | All submissions | Best solutions | Back to list |
DIFFSUMS - Different sums |
Wersja polska | English version |
Input
The input consist of unknown number of tests. Each test is a line with one integer x (0<=x<25). The input ends with x=0 (for which You shouldn't print anything).
Output
For each test You should print all possible non-decreasing sequences of integers (which may occur more than one time) which totalled equal x. In each sequence the i-th number should be greater than, or equal to, the preceding number. The sequences themselves should also be sorted into numerically ascending order.
Example
Input: 1
2
3
4
5
0 Output: 1
1 1
2
1 1 1
1 2
3
1 1 1 1
1 1 2
1 3
2 2
4
1 1 1 1 1
1 1 1 2
1 1 3
1 2 2
1 4
2 3
5
Special thanks to Łukasz Kuszner for the concept of this task.
Added by: | Piotr Kąkol |
Date: | 2011-06-18 |
Time limit: | 1.666s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: SCM qobi |
hide comments
|
||||||
2011-06-18 19:16:15 Jander
I would phrase it "In each sequence the i-th number should be greater than, or equal, to the preceding number. The sequences themselves should also be sorted into numerically ascending order." The given examples will be enough to clarify the above statement. Last edit: 2011-06-18 19:16:54 |
||||||
2011-06-18 18:24:23 Piotr KÄ…kol
I know. Any suggestions for clarifying it? And thank You for the remark. Last edit: 2011-06-18 19:56:55 |
||||||
2011-06-18 17:44:26 HWK
@Piotr: Content okay but difficult to read. ;-) |
||||||
2011-06-18 17:07:36 Piotr KÄ…kol
@HWK - Is it ok now in Your opinion? ;-) |
||||||
2011-06-18 15:42:14 HWK
@Piotr: In my opinion 'increasing lexicographical order' is unclear. I had assumed '10' before '2'. |