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

不好意思,现在才知道怎么链接问题序号……为什么总是presentation error?

Posted by C0400104048 at 2004-04-01 21:18:07 on Problem 1642
#include<stdio.h>
#define MAXBLOCK 20

main()
{char cube[MAXBLOCK][MAXBLOCK][MAXBLOCK];
 int blocks,i,j,k,hight,maxj,maxk;
 while(1)
 {   for(i=0;i<MAXBLOCK;i++)
     for(j=0;j<MAXBLOCK;j++)
	 for(k=0;k<MAXBLOCK;k++)
		 cube[i][j][k]=0;
	 scanf("%d",&blocks);
     if(blocks==0)break;
	 for(i=0;i<blocks;i++)
	 {   
		 for(j=0;;j++)
		 {   scanf("%d",&hight);
		     if(j==0&&i==0)maxk=hight;
		     if(hight==0)
			 {if(i==0)maxj=j;
			  break;
			 }
             for(k=0;k<hight;k++)
				 cube[i][j][k]=1;
		 }
	 }
	 j=k=0,i=blocks-1;
	 while(cube[i][j][k]==0&&i>0)
	 {blocks--;
	  i--;
	 }
	 for(k=0;k<maxk;k++)
	 {
		 for(i=0;i<blocks;i++)
		 {   j=0;
		     while(cube[i][j][k]==1)j++;
			 if(j==0)break;
			 if(i>0)printf(" ");
			 printf("%d",j);
		 }
		 printf("\n");
	 }
     printf("\n");
	 for(j=0;j<maxj;j++)
	 {
		 for(k=0;k<maxk;k++)
		 {   i=0;
		     while(cube[i][j][k]==1)i++;
			 if(i==0)break;
			 if(k>0)printf(" ");
			 printf("%d",i);
		 }
         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