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 |
Re:帮忙看一下,为什么WAIn Reply To:帮忙看一下,为什么WA Posted by:jxd at 2007-04-05 14:02:27 > #include <stdio.h> > int k[20]={1,2,4,8,16,32,64,128,256,512,1024,2048,4096}; > char s[10][10]={" /\\ ","/__\\"}; > void f(int a,int b,int n) > { > if(n==0)printf("%c",s[a][b]); > else if(a>=k[n]&&b<k[n+1])f(a-k[n],b,n-1); > else if(a>=k[n])f(a-k[n],b-k[n+1],n-1); > else if(b>=k[n]&&b<3*k[n])f(a,b-k[n],n-1); > else printf(" "); > } > int main() > { > int i,j,n,t,m; > scanf("%d",&t);//注释掉 > //while(t--)改为while(scanf("%d",&n)&&n) > { > scanf("%d",&n);//注释掉 还有一个地方要修正!n=n-1;这样就可以把你的程序修正过来了! > for(i=0;i<k[n+1];i++) > { > for(j=0;j<k[2,n+2];j++) > if(j<=k[2,n+1]+i)f(i,j,n); > printf("\n"); > } > printf("\n"); > } > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator