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 BrainDeveloper at 2010-02-08 13:21:08 on Problem 1915
In Reply To:老天呐。。。我开90000就AC否则AC不了 但开AC 编译器不能编译!!!!!!!!! Posted by:vince4053040 at 2010-02-05 16:57:52
> #include<iostream>
> using namespace std;
> 
> #define MAX 302
> int main()
> {
> 	int N, border;
> 	int begin_i, begin_j, end_i, end_j;
> 	int Row[90000], Col[90000];             //老天呐。。。我开90000就AC否则AC不了 但开AC不能编译!!!!!!!!!
> 	int que[90000];
> 	int visit[MAX][MAX];
> 	int front, rear, temp;
> 	int i, j;
> 	int row, col;
> 	int move[8][2] = {{-2, -1}, {-2, 1}, {-1, -2}, {-1, 2}, {1, -2}, {1, 2}, {2, -1}, {2, 1}};
> 	
> 	cin >> N;
> 	while(N --) {
> 		cin >> border;
> 		cin >> begin_i >> begin_j;
> 		cin >> end_i >> end_j;
> 		for(i = 0; i < border; i ++)
> 			for(j = 0; j < border; j ++)
> 				visit[i][j] = 0;
> 		front = rear = 0;
> 		Row[0] = begin_i;
> 		Col[0] = begin_j;
> 		visit[begin_i][begin_j] = 1;
> 		que[rear ++] = 0;
> 		int gg = 0;
> 		while(front < rear) {
> 			temp = front ++;
> 			if(Row[temp] == end_i && Col[temp] == end_j) 
> 				break;
> 			for(i = 0; i < 8; i ++) {
> 				row = Row[temp] + move[i][0];
> 				col = Col[temp] + move[i][1];
> 				if(row >= 0 && col >= 0 && row < border && col < border && visit[row][col] == 0) {
> 					visit[row][col] = 1;
> 					Row[rear] = row;
> 					Col[rear] = col;
> 					que[rear ++] = que[temp] + 1;
> 					//cout << "temp" <<rear << endl;
> 				}
> 			}
> 		}
> 		cout <<que[temp] << endl;
> 	}
> 	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