/*
Description:
HDU__ACM 2047 阿牛的EOF牛肉串
http://acm.hdu.edu.cn/showproblem.php?pid=2047
*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
using namespace std;
long long save[55];
long long f(int n)
{
if(save[n])
return save[n];
if(n == 1)
save[n] = 3;
else if(n == 2)
save[n] = 8;
else save[n] = 2*( f(n-1) + f(n-2) );
return save[n];
}
int main()
{
int n;
while(scanf("%d", &n) != EOF){
memset(save, 0, sizeof(save));
cout<<f(n)<<endl;
}
////system("pause");
return 0;
}
本文出自 “东方快翔” 博客,请务必保留此出处http://hustluy.blog.51cto.com/1792080/607327