我思路是對的,但一直超時。想來想去也不知道怎么減少時間復(fù)雜度。。。#include <iostream>#include <math.h>#include <iomanip>using namespace std;int main(){ int t,n, x,y; int b[20]; char a[400][4]; cin >> t; int t1 = t; while (t) { cin >> n; x = 0; y = 0; b[t1 - t] = 0; for (int i = 1; i < n * n; i+...