[恢]hdu 2044
2011-12-14 20:24:33
地址:http://acm.hdu.edu.cn/showproblem.php?pid=2044
题意:中文。
mark:递推,考虑a和b的差,注意要long long。
代码:
# include <stdio.h>
int main ()
{
int n, m, i ;
long long dp[55] = {1, 1} ;
for (i = 2 ; i <= 50 ; i++)
dp[i] = dp[i-1]+dp[i-2] ;
scanf ("%d", &n) ;
while (~scanf ("%d%d", &n, &m))
printf ("%I64d\n", dp[m-n]) ;
return 0 ;
}