Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
这么精彩的程序居然没有人跟贴,诡异.向您致敬~,用最简的(x%3+y%3)%2==0描述了该分形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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator