Problems
Contests
Events
Topic
IDE
PacketHub
Login
Description
Editorial
My Submission
1032.整数拆分
Look up all submission
Status
Time
Memory
Lang.
Submit Date
1032.整数拆分
Time Limit:1000MS Memory Limit:65535KB
Description
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!"
Input
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.
Output
For each test case, you have to output a line contains an integer P which indicate the different equations you have found.
Sample test
Sample input
4 10 20
Sample output
5 42 627
Note
Tags
Post editorial
Editorials
GNU C++ 9.3.0
GNU C 9.3.0
Java 1.8
Python 3.8.4
Lua 5.3
GO 1.12.4
JS - (nodejs 10.19.0)
Login before submit
Test Input
Test Output
4 10 20
Please run you code firstly.
Console
IDE Setting
字体设置
调整适合你的字体大小。
12px
13px
14px
15px
16px
18px
20px
主题设置
切换不同的代码编辑器主题,选择适合你的语法高亮。
Visual Studio
Visual Studio Dark
High Contrast Dark
行宽限制
设置每一行代码的最大字符个数,设置为0则不限制。
0
80
100
120