-->
当前位置:首页 > 题库

PROGRAMMING:Natural number splitting problem

Luz5年前 (2021-05-10)题库393
An integer n (n > 1) can be split into the sum of several natural numbers greater than or equal to 1. Please output all non duplicate splitting methods.
The so-called repeatability of splitting method is determined as follows: given $$n = a_ 1 + a_ 2 + ... a_{ M1} $$and $$n = b_ 1 + b_ 2 + ...b_{ M2} $$represents two splitting methods of integer n. For $$\ forall a_ i, b_ J \ \ GEQ 1 $$, let set $$a = \ {a}_ i| 1 \leq i \leq m_ 1\}, B= \{b_ j| 1 \leq j \leq m_ 2\}$$。 If the set $$a = B $$, then the two splitting methods are repeated.
For example, 6 = 3 + 2 and 6 = 2 + 3 are repeated splitting methods.
###Input format:
A positive integer n ($$1 / Leq n / Leq 52 $$).
**Note: the upper limit of n is 52, which is obtained after the PTA platform server test, and can ensure that the better search strategy is submitted in PTA and solved within 1 s. On the local PC, even the running time of a better method may be more than 1 s. if you think the method is OK, you can submit it first**
###Output format:
According to the dictionary order of splitting scheme, output all schemes from small to large. Please refer to the output example
###Input example:
Here is a set of inputs. For example:
```in
six
```
###Output example:
The corresponding output is given here. For example:
```out
6=1+1+1+1+1+1
6=1+1+1+1+2
6=1+1+1+3
6=1+1+2+2
6=1+1+4
6=1+2+3
6=1+5
6=2+2+2
6=2+4
6=3+3
6=6
```







answer:If there is no answer, please comment