Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
测试都过怎么会WA 谁给组测试数据啊#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator