1033.整数拆分 Ver.2
提交状态 耗时 内存 语言 提交时间

1033.整数拆分 Ver.2

时间限制:1000MS  内存限制:65535KB
题目描述
The problem is, given an positive integer N, we define an equation like this:
  N=a[1]+a[2]+a[3]+...+a[m];
  a[i]>0,1<=m<=N;
For example, assume N is 5, we can find:
  5=1+1+1+1+1
  5=1+1+1+2
  5=1+1+3
  5=1+2+2
  5=1+4
  5=2+3
  5=5
Note that "5 = 3 + 2" and "5 = 2 + 3" is the same in this problem. Now, you do it!"
But now , you must ouput all the equations in lexicographical order;
输入描述
The input contains several test cases. Each test case contains a positive integer N(1<=N<=20) which is mentioned above. The input is terminated by the end of file.
输出描述
For each test case, you have to output several lines indicate the different equations you have found.
示例
输入样例
3
4
输出样例
3=1+1+1
3=1+2
3=3
4=1+1+1+1
4=1+1+2
4=1+3
4=2+2
4=4
提示
The first case,you can't print 3=2+1(it's not lexicographical order),and you must print 3=1+1+1 before 3=1+2 .
相关标签
没有任何标签
登陆后才可以提交
测试输入
执行结果
控制台
代码编辑器配置
  • 字体设置
    调整适合你的字体大小。
  • 主题设置
    切换不同的代码编辑器主题,选择适合你的语法高亮。
  • 行宽限制
    设置每一行代码的最大字符个数,设置为0则不限制。