Description
There is a total of a staircase of M-class, just at the beginning of you in the first level, if you can only step up one level or two, to go to the grade m, how many kinds of methods?
Input
The input data first contains an integer n, which represents the number of test instances, followed by n rows of data, each containing an integer M (1<=m<=40) representing the series of stairs.
Output
For each test instance, please output the number of different methods.
Sample Input
223
Sample Output
12
#include <cstdio>#include<cstring>#include<iostream>#include<stdlib.h>#include<vector>#include<queue>#include<cmath>using namespacestd;#defineMAXN 100#defineOO 0x3f3f3f#definePI 3.1415926535897932intN;intK;Long LongDP[MAXN];voidinit () { for(intI=4; i<=maxn; i++) Dp[i]= dp[i-2] + dp[i-1];}intMain () {intt,m; scanf ("%d",&t); while(t--) {scanf ("%d",&m); dp[1] =1; dp[2] =1; dp[3] =2; Init (); printf ("%i64d\n", Dp[m]); } return 0;}
C-Super Staircase