Problem Description
There is a total of M-level stairs. At the beginning, you are at the first level. If you can only cross the upper or second level at a time, how many steps should you go to the level M?
Input
The input data first contains an integer N, indicating the number of test instances, and then N rows of data. Each row contains an integer M (1 <= M <= 40), indicating the level of the stairs.
Output
For each test instance, please output the number of different steps
Sample Input
2
2
3
Sample Output
1
2
Import java. io. bufferedInputStream; import java. util. *; public class Main {public static void main (String [] args) {consumer SC = new consumer (new BufferedInputStream (System. in); int k, m, n; k = SC. nextInt (); for (int I = 0; I <k; I ++) {m = SC. nextInt (); n = fun (m); System. out. println (n) ;}} public static int fun (int m) {int sum = 0; int a [] = new int [m]; for (int I = 2, j = 0; I <= m; I ++, j ++) {if (I = 2) {a [j] = 1; sum = a [j];} else if (I = 3) {a [j] = 2; sum = a [j];} else {a [j] = a [J-1] + a [J-2]; sum = a [j];} return sum ;}}