#include <iostream> using namespace std; int n; int shangtaijie(int n){ if(n==0)return 1; if(n<0)return 0; return shangtaijie(n-1)+shangtaijie(n-2); } int main(){ cin>>n; cout<<shangtaijie(n); }
2024-02-24 14:14:40
#include <iostream> using namespace std; int n; int shangtaijie(int n){ if(n==0)return 1; if(n<0)return 0; return shangtaijie(n-1)+shangtaijie(n-2); } int main(){ cin>>n; cout<<shangtaijie(n); }