|
PartitionTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1099 Accepted Submission(s): 648
Problem Description
How many ways can the numbers 1 to 15 be added together to make 15? The technical term for what you are asking is the "number of partition" which is often called P(n). A partition of n is a collection of positive integers (not necessarily distinct) whose sum equals n.
Now, I will give you a number n, and please tell me P(n) mod 1000000007.
Input
The first line contains a number T(1 ≤ T ≤ 100), which is the number of the case number. The next T lines, each line contains a number n(1 ≤ n ≤ 10
5) you need to consider.
Output
For each n, output P(n) in a single line.
Sample Input
Sample Output
Source
Recommend
zhuyuanchen520 | We have carefully selected several similar problems for you:
5717
5716
5715
5714
5713
题意:数字k写成和的形式,有多少种情况例如:
4 = {4} {1,3} {2,2} {1,1,2} {1,1,1,1} 共五种情况
在51 node上看到的这道题,标签是dp,但是确实是数学公式题,欧拉函数的倒数是
整数的划分的母函数
欧拉函数及其展开式是这样的
↓
把欧拉函数乘到右边展开 #include <iostream>
在 n>0 时,等式右侧的系数均为0,比较等式二侧的系数,可得
因此可得到分割函数p(n)的递归式:
|
hdu4651
最新推荐文章于 2021-07-19 11:50:37 发布