提交时间:2023-10-04 11:18:15

运行 ID: 104945

#include<iostream> using namespace std; int a[1005]; int main() { int n; cin >> n; a[1] = 1; a[2] = 2; for(int i = 3;i <= n;i++) { if(i % 2 == 0) a[i] = a[i - 1] + a[i / 2]; else a[i] = a[i - 1]; } cout << a[n] << endl; return 0; }