提交时间:2023-10-04 11:29:21
运行 ID: 104953
#include <iostream> #include <algorithm> #include <cstdio> #include <cmath> using namespace std; int main() { int f[10010]; int n; scanf("%d", &n); f[1] = 1; for (int i = 2;i <= n;i++) { if (i % 2) f[i] = f[i - 1]; else f[i] = f[i - 1] + f[i / 2]; } printf("%d", f[n]); return 0; }