2011-12-14 04:53:04
地址:http://acm.hdu.edu.cn/showproblem.php?pid=2042
题意:中文。。。递推。
代码:
# include <stdio.h>
int dp[35] = {3} ;
int main ()
{
int i, n, num ;
for (i = 1 ; i <= 30 ; i++)
dp[i] = (dp[i-1]-1) * 2 ;
scanf ("%d", &n) ;
while (n--)
{
scanf ("%d", &num) ;
printf ("%d\n", dp[num]) ;
}
return 0 ;
}