提交时间:2023-10-05 10:25:47
运行 ID: 105099
#include<bits/stdc++.h> using namespace std; int a[1005]; int f(int n){ if(!a[n]){ if(n == 1){ a[n] = 1; }else if(n%2){ a[n] = f(n -1); }else{ a[n] = f(n -1) + f(n/2); } } return a[n]; } int main(){ int n; scanf("%d",&n); printf("%d",f(n)); return 0; }