Hdu 2044 - 一只小蜜蜂...

注意:int过不了,__int64才A过

AC代码:

#include <stdio.h>
//#include <cmath>
//#include <cstring>
int main()
{
    int n, a, b;
    __int64 c[55];
    c[2] = 1;
    c[3] = 2;
    for(int i=4; i<=50; i++)
    {
        c[i] = c[i-1] + c[i-2];
    }
    scanf("%d", &n);
    while(n--)
    {
        scanf("%d%d", &a, &b);
        printf("%I64d\n", c[b-a+1]);
    }
    return 0;
}


 

你可能感兴趣的:(Hdu 2044 - 一只小蜜蜂...)