这篇博客是从旧博客 WordPress 迁移过来,内容可能存在转换异常。
题目地址:
http://acm.hdu.edu.cn/showproblem.php?pid=2045
有点小麻烦。。。
// Author: Tanky Woo
// HDOJ 2045
#include
#include
using namespace std;
__int64 result[55];
int main()
{
result[1] = 3;
result[2] = 6;
result[3] = 6;
for(int i=4; i<=50; ++i)
result[i] = result[i-1]+2*result[i-2];
int num;
while(scanf("%d", #) != EOF)
printf("%I64d\n", result[num]);
return 0;
}