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 KatrineYang at 2016-07-23 23:25:50 on Problem 1132
#include <stdio.h>
#include <string.h>
using namespace std;

int main() {
	int N;
	scanf("%d", &N);
	for(int ii = 0; ii < N; ii++){
		printf("Bitmap #%d\n", ii+1);
		int startX, startY;
		char lj[1025] = {'\0'};
		scanf("%d%d%s", &startX, &startY, lj);
		int len = strlen(lj);
		len --;
		bool state[32][32] = {false};
		int x = startX, y = startY;
		for(int i = 0; i < len; i++){
			char c = lj[i];
			switch(c){
				case 'E':{
					state[x][y-1] = true;
					x++;
					break;
				}
				case 'N':{
					state[x][y] = true;
					y++;
					break;
				}
				case 'W':{
					state[x-1][y] = true;
					x--;
					break;
				}
				case 'S':{
					state[x-1][y-1] = true;
					y--;
					break;
				}
				default:
					break;
			}
		}
		for(int i = 31; i >= 0; i--){
			for(int j = 0; j < 32; j++){
				if(!state[j][i])printf(".");
				else printf("X");
			}
			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