提交时间:2023-10-05 10:27:20
运行 ID: 105103
#include<bits/stdc++.h> using namespace std; int a[1001]; 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; cin>>n; cout<<f(n); return 0;}