Files
python/TangDou/LuoGuBook/P1028_2.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

24 lines
465 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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;
}