1396: 自然数拆分

Memory Limit:128 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:265 Solved:135

Description

一个整数n(n<=30)可以有多种分划,使其分划的一列正整数之和为n。例如: 输入:n=6 输出格式内容为 6=1+5 6=1+1+4 6=1+1+1+3 6=1+1+1+1+2 6=1+1+1+1+1+1 6=1+1+2+2 6=1+2+3 6=2+4 6=2+2+2 6=3+3 total=10{表示分划数有10种}

Input

一个正整数n

Output

可拆分成的所有不重复等式,一行一个等式,有一定顺序;

最后再输出一行,total=个数

Sample Input Copy

6

Sample Output Copy

6=1+5
6=1+1+4
6=1+1+1+3
6=1+1+1+1+2
6=1+1+1+1+1+1
6=1+1+2+2
6=1+2+3
6=2+4
6=2+2+2
6=3+3
total=10

加入题单

算法标签: