Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

参考递归函数!

Posted by gengyit at 2007-05-20 22:35:34 on Problem 2876
char str[531442];
递归入口
loop=pow(3,n);
memset(str,'-',loop);
re(str,n);
递归函数
void re(char *s,int n)
{
	if(n==1)
	{
		s[1]=' ';
		return;
	}
	int loop=pow(3,n-1);
	for(int i=0;i<loop;i++)
	{
		s[loop+i]=' ';
	}
	re(s,n-1);
	re(&s[loop+loop],n-1);
}
注意要特殊处理0的情况


Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator