Description
A trained bee can only crawl to the adjacent beehive on the right, and cannot reverse crawl ..
Try to find the number of possible routes for the bee to climb from the beehive A to the beehive B.
-
Input
-
An integer in the first row indicates the number of data groups (multiple groups of data). For each group of data, only one row has two integers, A and B (1 ≤ A <B ≤ 40)
-
Output
-
For each group of inputs, output a line, that is, the number of possible routes from the master a to the Master B.
-
Sample Input
-
11 5
-
Sample output
-
5
finding a regular solution involves a superposition Process
# include
int temp1; int temp2; Main () {int m, n, T, I; double upset [1000]; int number, Te; int A, B; scanf ("% d", & number); For (TE = 1; te <= number; Te ++) {m = 2; scanf ("% d ", & A, & B); n = b-a-1; temp1 = m; temp2 = N; upset [0] = 1; for (I = 1; I <= temp1; I ++) upset [I] = I + 1; if (temp2 <= temp1) {for (I = 1; I <= temp2; I ++) upset [I] = I + 1; printf ("%. 0lf \ n ", upset [temp2]);} If (temp2> temp1) {for (I = temp1 + 1; I <= temp2; I ++) upset [I] = upset [I-1] + upset [i-temp1]; printf ("%. 0lf \ n ", upset [temp2]) ;}}