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

Re:code here

Posted by pcxjx at 2005-08-27 14:33:58 on Problem 2083
In Reply To:code here Posted by:Essence_me at 2005-08-27 13:45:40
嗯,清空的时候只有map前面部分 i<3===>i<7
> #include <stdio.h>
> #include <math.h>
> 
> int size;
> char map[7][800][800];
> void copy(int x,int y,int ii)
> {
> 	int i,j;
> 	for(i=0;i<size;i++)
> 		for(j=0;j<size;j++)
> 			map[ii][i+x][j+y]=map[ii-1][i][j];
> }
> int main()
> {
> 
> 	int i,j,k,n;
> 	for(i=0;i<3;i++)
> 		for(j=0;j<800;j++)
> 			for(k=0;k<800;k++)
> 				map[i][j][k]=' ';
> 	map[0][0][0]='X';
> 	for(i=1;i<7;i++)
> 	{
> 		size=(int)pow(3,i-1);
> 		copy(0,0,i);
> 		copy(0,size*2,i);
> 		copy(size,size,i);
> 		copy(size*2,0,i);
> 		copy(size*2,size*2,i);
> 	}
> 	while(1)
> 	{
> 		scanf("%d",&n);
> 		if(n==-1)break;
> 		if(n!=0)
> 		{
> 			size=(int)pow(3,n-1);
> 			for(i=0;i<size;i++)
> 			{
> 				for(j=0;j<size;j++)
> 					printf("%c",map[n-1][i][j]);
> 				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