P1028 数的计算

#include<iostream>
#include<vector>
using namespace std;

#define LL long long

const int N = 1010;
// f(i) 表示以i为开始,能够得到的满足性质的数的个数
// f(i) = 1 + f(k), k <= i / 2

int f[N];
int n;

int main(){
    cin >> n;
    
    for(int i = 1; i <= n; i ++){
        f[i] = 1;
        for(int j = 1; j <= i / 2; j ++)
            f[i] += f[j];
    }
            
    cout << f[n];
    
    return 0;
}
原文地址:https://www.cnblogs.com/tomori/p/13778708.html