通过代码:
#include <bits/stdc++.h> #define LL long long using namespace std; LL n, F[1001]; LL f(LL _n) { if(F[_n] != 0) return F[_n]; else if(_n == 1) return 1; LL sum = 1; for(LL i = 1; i <= _n / 2; i ++) sum += f(i); return F[_n] = sum; } int main() { scanf("%lld", &n); printf("%lld", f(n)); return 0; }
1316:【例4.6】数的计数(Noip2001)
最新推荐文章于 2024-04-04 19:26:12 发布