Copyright: qq836678589 https://blog.csdn.net/weixin_43924623/article/details/91391023
A small bee ...
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 111122 Accepted Submission(s): 39257
Problem Description
There is a trained bees can only be climbed right adjacent hive, not the reverse crawl. Calculation program a number of possible routes to climb bee hive from hive b a.
Wherein the honeycomb structure shown below.
Input
first line of input data N is an integer, indicates the number of test cases, then the N rows, each row comprising two integers a and b (0 <a <b < 50).
Output
For each test case, output a number of possible routes to climb the bees from hive hive b a, the output of each row for instance.
Sample Input
2
1 2
3 6
Sample Output
1
3
#include<iostream>
using namespace std;
int main(){
int n,a,b;
long long ar[51]={0,1,2,3};
for(int i=4;i<=50;i++)
ar[i]=ar[i-1]+ar[i-2];
cin>>n;
while(n--){
cin>>a>>b;
cout<<ar[b-a]<<endl;
}
return 0;
}