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了呢?

Posted by doommetal at 2008-04-01 17:40:19 on Problem 1132
In Reply To:Runtime Error疯了。实在找不到RE的原因啊!!! Posted by:doommetal at 2008-04-01 17:31:25
#include<stdio.h>
#include<string.h>
#define maxn 32
int maze[maxn][maxn];
int main()
{
	//freopen("f.in","r",stdin);

	int t,i,j,x,y,k,cs=1;
	char ch;
	char str[maxn];
	scanf("%d",&t);
	while(t--)
	{
		printf("Bitmap #%d\n",cs++);
		scanf("%d%d\n",&x,&y);
		memset(maze,0,sizeof(maze));
		//scanf("%s\n",str);
		//for(i=0;str[i]!='.' && str[i];i++)
		for(;(ch=getchar())!='.';)
		{
			switch(ch)
			{
			case 'E':maze[x][y-1]=1;x++;break;
			case 'N':maze[x][y]=1;y++;break;
			case 'W':maze[x-1][y]=1;x--;break;
			case 'S':maze[x-1][y-1]=1;y--;break;
			default:break;
			}
		}
		getchar();
		for(j=31;j>=0;j--){
			for(i=0;i<32;i++)
				if(maze[i][j])
					printf("X");
				else
					printf(".");
			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