记录编号 44493 评测结果 AAAAA
题目名称 [长郡中学2004] 0/1字符串问题 最终得分 100
用户昵称 GravatarTruth.Cirno 是否通过 通过
代码语言 C++ 运行时间 0.002 s
提交时间 2012-10-18 21:39:47 内存使用 3.15 MiB
显示代码纯文本
#include <iostream>
#include <cstdio>
using namespace std;

const int ans[]={0,2,4,6,10,16,24,36,56,80,118,174,254,378,554,802,1168,1716,2502,3650,5324,7754,11320,16502,24054,35058,51144,74540,108664,158372,230800,336480,490458,714856,1041910,1518840,2213868,3226896,4703372,6855388,9992596};

int n/*,total,rec[50]*/;
/*
void dfs(int deep,int num)
{
	int i,j,k,a[4];
	rec[deep]=num;
	for (i=1;i*3<=deep;i++)
	{
		for (j=1;j<=3;j++)
		{
			a[j]=0;
			for (k=deep-i*(j-1);k>deep-i*j;k--)
				a[j]=(a[j]<<1)+rec[k];
		}
		if (a[1]==a[2]&&a[2]==a[3])
			return;
	}
	if (deep==n)
	{
		total++;
		return;
	}
	dfs(deep+1,0);
	dfs(deep+1,1);
}
*/
int main(void)
{
	freopen("str01.in","r",stdin);
	freopen("str01.out","w",stdout);
	cin>>n;
/*	cout<<"{";
	for (n=1;n<=40;n++)
	{
		total=0;
		dfs(1,0);
		dfs(1,1);
		if (n!=40)
			cout<<total<<",";
		else
			cout<<total<<"};";
	}*/
	cout<<ans[n]<<endl;
	return(0);
}