Files
python/TangDou/LuoGuBook/P1028_2.cpp

24 lines
465 B
C++
Raw Normal View History

2025-08-30 18:35:01 +08:00
#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int f[N];
int n;
int main() {
//输入
cin >> n;
//边界条件:1
f[1] = 1;
for (int i = 2; i <= n; i++) {
//任何数字,独立成为一个
f[i] = 1;
//所有从1到它的一半的,都可以增加进来
for (int j = 1; j <= i / 2; j++) f[i] += f[j];
}
//总个数
cout << f[n] << endl;
return 0;
}