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

测试都过怎么会WA 谁给组测试数据啊

Posted by vince4053040 at 2010-03-13 22:25:12 on Problem 3752
#include<iostream>
using namespace std;

#define MAX 300

int rec[MAX][MAX];

void map(int row, int col, int time)
{
	if(row < 0 || col < 0)
		return ;
	int i;
	for(i = time; i < col + time; i ++) {
		if(rec[time][i - 1] >= 27)
			rec[time][i - 1] -= 26;
		if(rec[time][i] != 0) return ;
		rec[time][i] = rec[time][i - 1]  + 1;
	}
	for(i = time + 1; i < row + time; i ++) {
		if(rec[i - 1][col + time - 1] >= 27)
			rec[i - 1][col + time - 1] -= 26;
		if(rec[i][col + time - 1]) return ;
		rec[i][col + time - 1] = rec[i - 1][col + time - 1] + 1;
	}
	for(i = time + col - 2; i >= time; i --) {
		if(rec[time + row - 1][i + 1] >= 27)
			rec[time + row - 1][i + 1] -= 26;
		if(rec[time + row - 1][i]) return ;
		rec[time + row - 1][i] = rec[time + row - 1][i + 1] + 1;
	}
	for(i = time + row - 2; i > time; i --) {
		if(rec[i + 1][time] >= 27)
			rec[i + 1][time] -= 26;
		if(rec[i][time]) return ;
		rec[i][time] = rec[i + 1][time] + 1;
	}
	map(row - 2, col - 2, time + 1);
}

int main()
{
	int row, col;
	cin >> row >> col;
	memset(rec, 0, sizeof(rec));
	map(row, col, 0);
	for(int i = 0; i < row; i ++) {
		for(int j = 0; j < col; j ++)
			printf("   %c", rec[i][j] + 64);
		cout << 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