link:
https://www.acwing.com/problem/content/281/
Meaning of the questions:
Given a natural number N, N required to be split into several positive integers the sum of formats in the adding operation may be repeated a number.
Program Number 2147483648 seeking result of splitting mod.
Ideas:
Multiple backpack, but do not enumerate to n.
Code:
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const unsigned int MOD = 2147483648;
LL Dp[10010];
int n, m;
int main()
{
scanf("%d", &n);
Dp[0] = 1;
for (int i = 1;i < n;i++)
{
for (int j = i;j <= n;j++)
Dp[j] = (Dp[j]+Dp[j-i])%MOD;
}
printf("%lld\n", Dp[n]);
return 0;
}