题目链接:HDU2044
将a设为起点,b为终点 手推几个发现 就是 斐波那契数列。
一开始写的int爆掉了 = =
ACcode:
/*
2017年9月18日21:24:04
HDU2044
AC
*/
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
/*一开始写的int 爆掉了*/
const ll maxn=55;
ll f[maxn];
void tb(){
f[1]=f[2]=1;
for(ll i=3;i<=50;i++){
f[i]=f[i-1]+f[i-2];
// printf("f[%d]=%d\n",i,f[i]);
}
}
int main(){
ll t;
scanf("%lld",&t);
tb();
while(t--){
ll a,b;
scanf("%lld%lld",&a,&b);
printf("%lld\n",f[b-a+1]);
}
return 0;
}