You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
465 B

2 years ago
#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;
}