1.题目链接:
http://acm.hdu.edu.cn/showproblem.php?pid=2045
2.参考代码:
#include <stdio.h>
int main()
{
int n,i;
__int64 a[55];
a[0]=0;
a[1]=3;
a[2]=6;
a[3]=6;
for(i=4;i<=50;i++)
a[i]=a[i-1]+2*a[i-2];
while(~scanf("%d",&n))
printf("%I64d\n",a[n]);
return 0;
}