打卡

来源:互联网 发布:淘宝账号密码共享2017 编辑:程序博客网 时间:2024/04/28 23:52

今天考完试了。

还是没有做题。很不应该,不过我做了许多其他的事,比如完成了10个锻炼,练了字,了解到了两个搜索bt和番号的网站。收拾了一点院子……

/*********************************************************************************************************************************************************/

超级楼梯

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 37297    Accepted Submission(s): 19154


Problem Description
有一楼梯共M级,刚开始时你在第一级,若每次只能跨上一级或二级,要走上第M级,共有多少种走法?
 

Input
输入数据首先包含一个整数N,表示测试实例的个数,然后是N行数据,每行包含一个整数M(1<=M<=40),表示楼梯的级数。
 

Output
对于每个测试实例,请输出不同走法的数量
 

Sample Input
223
 

Sample Output
12
 

Author
lcy
 

Source
2005实验班短学期考试
 

Recommend
lcy   |   We have carefully selected several similar problems for you:  2045 2050 2049 1297 2190 
 
#include<queue>#include<math.h>#include<stdio.h>#include<string.h>#include<iostream>#include<algorithm>using namespace std;#define N 55int n;int main(){__int64 f[N];__int64 o[N];f[1]=2;f[2]=6;o[3]=2;o[2]=1;for(int i=4;i<=52;i++){o[i]=o[i-1]+o[i-2];//f[i]=(f[i-1]+o[i-1])*2;}int t;cin>>t;while(t--){cin>>n;cout<<o[n]<<endl;}    return 0;}//freopen("1.txt", "r", stdin);    //freopen("2.txt", "w", stdout);//**************************************


0 0
原创粉丝点击