#include <iostream> using namespace std; const int N = 5010; int a[N][N]; int dx[] = {1, 1, 1, -1}, dy[] = {1, -1, 1, 1}; int main() { //预处理 int k = 1; int sx=0,sy=0; for(int i=0;i<=10000;i++){ sx=sx+dx[i%4]; sy=sy+dy[i%4]; a[sx][sy]=k; k++;...