记录编号 31124 评测结果 RRRRRRRRRR
题目名称 [USACO Oct07] 贝茜的秘密牧场 最终得分 0
用户昵称 Gravatar201101 是否通过 未通过
代码语言 C++ 运行时间 0.000 s
提交时间 2011-11-01 17:19:28 内存使用 0.26 MiB
显示代码纯文本
#include <cstdio>
using namespace std;

int c,p2[102]={0};

void tryit(int deep,int rest)
{
	int i,temp;
	if (deep==3)
	{
		temp=rest;
		for (i=1;temp>=0;i++)
		{
			if (temp==0)
			{
				c++;
				return;
			}
			temp=rest-p2[i];
		}
		return;
	}
	temp=rest;
	for (i=1;temp>=0;i++)
	{
		tryit(deep+1,temp);
		temp=rest-p2[i];
	}
}

int main(void)
{
/*	printf("Please wait for a moment...");
	freopen("program.cpp","w",stdout);
	printf("#include <cstdio>\n");
	printf("using namespace std;\n");
	printf("\n");
	printf("int main(void)\n");
	printf("{\n");
	printf("\tfreopen(\"secpas.in\",\"r\",stdin);\n");
	printf("\tfreopen(\"secpas.out\",\"w\",stdout);\n");
	printf("\tint n,a[10001]={");
	int n;
	for (n=1;n<=101;n++)
		p2[n]=n*n;
	for (n=0;n<10000;n++)
	{
		c=0;
		tryit(0,n);
		printf("%d,",c);
	}
	c=0;
	tryit(0,n);
	printf("%d};\n",c);
	printf("\tscanf(\"%%d\\n\",&n);\n");
	printf("\tprintf(\"%%d\\n\",a[n]);\n");
	printf("\tfclose(stdin);\n");
	printf("\tfclose(stdout);\n");
	printf("\treturn(0);\n");
	printf("}\n");
	fclose(stdout);
*/	return(0);
}