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 |
晕,我知道了……是n=1时考虑错了……郁闷In Reply To:为什么会输出格式错误??高手帮忙看一下……万分感谢!! Posted by:byron at 2006-07-11 12:06:38 > #include <stdio.h> > #include <string.h> > > int two[11]; > char map[2050][2050]; > int n; > int l,r; > int i; > int j; > int x; > void huafen(int size,int xtop,int ytop) > { > if(size==1) return; > else > { > int ll,rr,i1,j1; > int count; > ll=xtop; > rr=xtop+1; > i1=ytop+two[size]-1; > for(count=0;count<two[size-1];i1--,ll--,rr++,count++) > { > map[i1][ll]='\\'; > map[i1][rr]='/'; > } > for(j1=ll+2,count=0;count<two[size]-2;count++) > { > map[i1][j1++]='_'; > } > huafen(size-1,xtop,ytop); > huafen(size-1,ll,i1+1); > huafen(size-1,rr-1,i1+1); > } > } > > > void main() > { > two[1]=2; > two[2]=4; > two[3]=8; > two[4]=16; > two[5]=32; > two[6]=64; > two[7]=128; > two[8]=256; > two[9]=512; > two[10]=1024; > two[11]=2048; > scanf("%d",&n); > while(n!=0) > { > memset(map,' ',sizeof(char)*2048*2048); > if(n==1) > { > printf(" /\\ \n"); > printf("/__\\ \n"); > } > else > { > l=two[n]-1; > r=two[n]; > for(i=0;i<two[n];l--,r++,i++) > { > map[i][l]='/'; > map[i][r]='\\'; > } > for(j=1;j<two[n+1]-1;j++) > { > map[i-1][j]='_'; > } > huafen(n,two[n]-1,0); > x=two[n]+1; > for(i=0;i<two[n];i++,x++) > { > for(j=0;j<x;j++) > { > printf("%c",map[i][j]); > } > printf("\n"); > } > printf("\n"); > } > scanf("%d",&n); > } > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator