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

为什么浙大能过这里过不了???

Posted by yipeng at 2005-07-16 13:20:20 on Problem 1120
#include "stdio.h"
#include "memory.h"
int a1[30][30],b1[30][30],d[30];
int main(){
	int i,j,k,t;
	while(scanf("%d",&t)!=EOF){
		for(i=0;i<16;i++)
			scanf("%d",&d[i]);
		memset(a1,0,sizeof(a1));
		memset(b1,0,sizeof(b1));
		for(i=1;i<=20;i++){
			for(j=1;j<=20;j++)
				scanf("%d",&a1[i][j]);
		}
		int sum;
		for(i=1;i<=t;i++){
			for(j=1;j<=20;j++){
				for(k=1;k<=20;k++){
					sum=a1[j-1][k]+a1[j][k]+a1[j+1][k]+a1[j][k-1]+a1[j][k+1];
					b1[j][k]=a1[j][k]+d[sum];
					if(sum>15||sum<0)
						while(1) printf("111");
					if(b1[j][k]<0)
						b1[j][k]=0;
					if(b1[j][k]>3)
						b1[j][k]=3;	
				}
			}
			for(j=1;j<=20;j++){
				for(k=1;k<=20;k++)
					a1[j][k]=b1[j][k];
			}
		}
		for(i=1;i<=20;i++){
			for(j=1;j<=20;j++){
				if(a1[i][j]==0)
					printf(".");
				if(a1[i][j]==1)
					printf("!");
				if(a1[i][j]==2)
					printf("X");
				if(a1[i][j]==3)
					printf("#");
			}
			printf("\n");
		}
	//	printf("\n");
	}
	return 0;
}



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