[恢]hdu 2563

2011-12-30 19:16:59

地址:http://acm.hdu.edu.cn/showproblem.php?pid=2563

题意:中文。递推。

代码:

# include <stdio.h>


int dp[25][2] = {1, 0} ;


int main ()
{
int i, n ;
for (i = 1 ; i <= 20 ; i++)
{
dp[i][0] = dp[i-1][0] + dp[i-1][1] ;
dp[i][1] = dp[i][0] + dp[i-1][0] ;
}
scanf ("%d", &n) ;
while (~scanf ("%d", &n))
printf ("%d\n", dp[n][0] + dp[n][1]) ;
return 0 ;
}


 

posted @ 2012-01-07 00:11  Seraph2012  阅读(215)  评论(0编辑  收藏  举报