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

帮忙看一下,为什么WA

Posted by jxd at 2007-04-05 14:02:27 on Problem 1941
#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--)
	{
		scanf("%d",&n);
		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:
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