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

这么精彩的程序居然没有人跟贴,诡异.向您致敬~,用最简的(x%3+y%3)%2==0描述了该分形

Posted by tzkq at 2010-07-27 18:16:56 on Problem 2083 and last updated at 2010-07-27 19:30:42
In Reply To:这学期第一道程序,发贴庆祝一下 Posted by:jxd at 2006-09-19 13:56:41
int i,n,k,x,y,t;
main(){
	for(;scanf("%d",&n)&&0<n;puts("-")){
		k=pow(3,n-1);
		for(i=0;i<k*k;i++){
			for(x=i/k,y=i%k,t=n;--t&&(x%3+y%3)%2==0;x/=3,y/=3);
			printf("%c%s",t?32:88,i%k<k-1?"":"\n");
		}
	}
}

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