[恢]hdu 2064
2011-12-15 05:08:51
地址:http://acm.hdu.edu.cn/showproblem.php?pid=2064
题意:中文。。。
mark:递推。dp[i] = dp[i-1]*3+2。
代码:
# include <stdio.h>
long long dp[40] = {0, 2} ;
int main ()
{
int i, n ;
for (i = 2 ; i <= 35 ;i ++)
dp[i] = dp[i-1]*3 + 2 ;
while (~scanf ("%d", &n))
{
printf ("%I64d\n", dp[n]) ;
}
return 0 ;
}