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

1032.整数拆分

时间限制: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;
My question is how many different equations you can find for a given N.
For example, assume N is 4, we can find:
  4 = 4;
  4 = 3 + 1;
  4 = 2 + 2;
  4 = 2 + 1 + 1;
  4 = 1 + 1 + 1 + 1;
so the result is 5 when N is 4. Note that "4 = 3 + 1" and "4 = 1 + 3" is the same in this problem. Now, you do it!"
 
输入描述
The input contains several test cases. Each test case contains a positive integer N(1<=N<=120) which is mentioned above. The input is terminated by the end of file.
输出描述
For each test case, you have to output a line contains an integer P which indicate the different equations you have found.
示例
输入样例
4
10
20
输出样例
5
42
627
提示
相关标签
没有任何标签
登陆后才可以提交
测试输入
执行结果
控制台
代码编辑器配置
  • 字体设置
    调整适合你的字体大小。
  • 主题设置
    切换不同的代码编辑器主题,选择适合你的语法高亮。
  • 行宽限制
    设置每一行代码的最大字符个数,设置为0则不限制。