Problem Jtime limit:2000/1000ms (java/other) Memory limit:65536/32768k (Java/other) total submission (s): + Accept Ed Submission (s): 30Problem 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 at a time, to go to the grade m, how many kinds of methods?
Input data first contains an integer n, which represents the number of test instances, followed by n rows of data, each line containing an integer M (1<=m<=40), representing the series of stairs.
Output for each test instance, print out the number of different methods
Sample Input223
Sample Output12 Simple water question::
# include <iostream># include<cstdio># include<cstring># include<cmath># include<string># include<algorithm># include<vector>using namespacestd;intdp[1001];intMain () {intT; CIN>>T; while(t--) {memset (DP,0,sizeof(DP)); intN; CIN>>N; dp[2] =1; dp[3] =2; for(inti =4; I <= N; i++) {Dp[i]= Dp[i-1] + dp[i-2]; } cout<< Dp[n] <<Endl; } return 0;}
HDU Dynamic Programming J