这篇博客是从旧博客 WordPress 迁移过来,内容可能存在转换异常。
题目地址:
http://acm.hdu.edu.cn/showproblem.php?pid=2044
水题~递推~
// Author: Tanky Woo
// HDOJ 2044
#include
#include
using namespace std;
__int64 arr[55];
int main()
{
arr[1] = 1;
arr[2] = 2;
arr[3] = 3;
for(int i=4; i<51; ++i)
arr[i] = arr[i-2]+arr[i-1];
int nCases;
scanf("%d", &nCases;);
int a, b;
while(nCases--)
{
scanf("%d %d", &a;, &b;);
printf("%I64d\n", arr[b-a]);
}
return 0;
}