#include "iostream"
using namespace std;
long long path (int n);
int main(){
int count;
int a,b;
cin >>count;
while (cin>>a>>b && count--){
long long num1 = 1;
long long num2 = 1;
int num = b - a + 1;
for (int i = 3; i <= num; i++){
num2 = num1 + num2;
num1 = num2 - num1;
}
cout<<num2<< endl;
}
return 0;
}
做OJ千万注意边界问题,同时啊,尽量斐波那契数列不要递归,此为标准递归做法,不容易超时。