Export
A different number of moves, each row corresponding to an input line of output
Sample input
5
8
10
Sample Output
8
34
89
Block
#include<iostream>
using namespace std;
int stair(int n){//表示n级台阶有多少种走法
if( n == 0 )
return 1;
if( n == 1 )
return 1;
return stair( n-1 ) + stair( n-2 );
}
int main(){
int n;
while(cin>>n)
cout<<stair(n)<<endl;
return 0;
}