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

狂汗啊。。 用C++ WA,用G++就AC,怎么回事啊。 晕死了。 服务器BUG?

Posted by orangelegend at 2007-12-16 23:20:49 on Problem 1132
代码如下:   高手指点啊。
怎么会这样。。。

#include <iostream.h>
#include<stdio.h>
#include <string.h>
short flag[35][35];
int main()
{

	int i,j,k,n,x,y;
	char str;
	scanf("%d",&n);
	for (k = 1; k <= n; k++)
	{
		scanf("%d%d",&x,&y);
		memset(flag,0,sizeof(flag));
		while(cin>>str)
		{
			if(str == 'E')
			{
				flag[y - 1][x] = 1;
				x++;
			}
			else if (str == 'W')
			{
				flag[y][x - 1] = 1;
				x--;
			}
			else if (str == 'N')
			{
				flag[y][x] = 1;
				y++;
			}
			else if (str == 'S')
			{
				flag[y - 1][x - 1] = 1;
				y--;
			}
			else break;
			
		}
		printf("Bitmap #%d\n",k);
		for (i = 31; i >= 0; i--)
		{
			for (j = 31; j >= 0; j--)
				if (flag[i][31 - j] == 1)
					printf("X");
				else 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