A little bee...
Problem Description
There is a trained bee that can only crawl to the adjacent hive on the right, not reverse. Please program to calculate the number of possible routes a bee can take to climb from hive a to hive b.
Among them, the structure of the hive is shown below.
Among them, the structure of the hive is shown below.
Input
The first line of the input data is an integer N, representing the number of test instances, followed by N lines of data, each line contains two integers a and b (0<a<b<50).
Output
For each test instance, please output the number of possible routes the bees can crawl from hive a to hive b, one line per instance.
Sample Input
2
1 2
3 6
Sample Output
1
3
#include<bits/stdc++.h> using namespace std; intmain() { long long int a[60]; a[0]=1; a[1]=1; for(int i=2;i<59;i++) { a[i]=a[i-1]+a[i-2]; } int n,c,d; scanf("%d",&n); while(n--) { scanf("%d%d",&c,&d); printf("%lld\n",a[d-c]); } return 0; }