#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main ()
{
int n,i;
ll a[55];a[1]=3;
while(scanf("%d",&n)==1)
{
if(n>1)
{
a[n] = pow(2,n)+pow(-1,n)*2;
printf("%lld\n",a[n]);
}
else printf("%d\n",a[1]);
}
return 0;
}
备注:此题可联系高中排列组合中 环形着色问题
[题目链接]
(http://acm.hdu.edu.cn/showproblem.php?pid=2045)