Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total Submission (s): 47766 Accepted Submission (s): 17402
Problem description A trained bee can only crawl to the right side of the hive and cannot crawl backwards. Please program the number of possible routes that bees crawl from hive A to hive B.
Among them, the structure of the hive is shown below.
The first line of input data is an integer n, representing the number of test instances, followed by n rows of data, each containing two integers a and B (0<a<b<50).
Output for each test instance, print the number of possible routes that the bee crawls from hive A to hive B, with the output of each instance one row.
Sample Input
21 23 6
Sample Output
13
#include <stdio.h>
Main ()
{
int a,b,i,j,n;
__int64 x[1000];
scanf ("%d", &n);
while (n--)
{
scanf ("%d%d", &a,&b);
X[1]=1;
x[2]=2;
for (i=3;i<=50;i++)
X[I]=X[I-1]+X[I-2];
printf ("%i64d\n", x[b-a]);
}
return 0;
}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
A little bee ...