题解 | #跳台阶#
跳台阶
https://www.nowcoder.com/practice/bfb2a2b3cdbd4bd6bba0d4dca69aa3f0
#include<bits/stdc++.h> using namespace std; long long a[55]={0,1,2},n; int main() { for(int i=3;i<=50;i++) a[i]=a[i-1]+a[i-2]; while(cin>>n) cout<<a[n]<<endl; return 0; }
给个赞吧!