提交时间:2023-11-25 08:14:25
运行 ID: 111804
#include<iostream> using namespace std; typedef long long ll; ll n, a[10010] = {0, 1, 2}; ll f(ll x){ if(a[x] != 0) return a[x]; return a[x] = f(max(x-1, 0ll)) + f(max(x-2, 0ll)); } int main(){ cin >> n; cout << f(n); return 0; }