/*鼠标点击特效*/

超级楼梯

http://10.12.162.1:5880/contest/4/problem/P0203
有一楼梯共M级,刚开始时你在第一级,若每次只能跨上一级或二级,要走上第M级,共有多少种走法?

#include<iostream>
using namespace std;
int main(){
    long long res[41];
    res[1]=1;
    res[2]=1;
    for(int i = 3;i<=40;i++)
    {
        res[i] = res[i-1] + res[i-2];
    }
    int n, t;
    cin>>n;
  	res[1]=0;
    while(n--)
    {
      	scanf("%d",&t);
        //cin>>t;
     	printf("%lld\n",res[t]);
       //cout<<res[t]<<endl;		//大量输入输出-->使用cin  cout超时
    }
    return 0;
}
posted @ 2020-11-06 19:16  干饭啦  阅读(132)  评论(0编辑  收藏  举报