mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 22:28:48 +00:00
279. 自然数拆分
https://www.acwing.com/problem/content/submission/code_detail/13028632/
This commit is contained in:
parent
3a25292160
commit
c8ab9bc261
28
AcWing/279/279.cpp
Normal file
28
AcWing/279/279.cpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using std::cin;
|
||||||
|
using std::cout;
|
||||||
|
const char endl = '\n';
|
||||||
|
|
||||||
|
const int N = 4005;
|
||||||
|
const long long mod = 2147483648;
|
||||||
|
|
||||||
|
int n;
|
||||||
|
long long f[N];
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::ios::sync_with_stdio(false);
|
||||||
|
|
||||||
|
cin >> n;
|
||||||
|
|
||||||
|
f[0] = 1;
|
||||||
|
for (int i = 1; i <= n; i++) {
|
||||||
|
for (int j = i; j <= n; j++) {
|
||||||
|
f[j] = (f[j] + f[j - i]) % mod;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cout << f[n] - 1 << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user