注意分类讨论,第n-1个格子和第一个格子同色时第n个格子有两种涂法,不同色就只有一种。#define Max 55
#include<cstdio>
#include<cstring>
#include<cctype>
int n;
long long c[Max];
int main(){
//freopen("input.txt","r",stdin);
c[1]=3;c[2]=6;c[3]=6;
long long k=3;
for(int i=3;i<=50;i++)
{
k=k*2;c[i]=(k-c[i-1])*2+c[i-1];
}
while(~scanf("%d",&n))
{
printf("%I64d\n",c[n]);
}
return 0;
}
#define Max 55
#include<cstdio>
#include<cstring>
#include<cctype>
int n;
long long c[Max];
int main(){
//freopen("input.txt","r",stdin);
c[1]=3;c[2]=6;c[3]=6;
long long k=3;
for(int i=3;i<=50;i++)
{
k=k*2;c[i]=(k-c[i-1])*2+c[i-1];
}
while(~scanf("%d",&n))
{
printf("%I64d\n",c[n]);
}
return 0;
}