枚举每一种解,检查是否符合条件即可。解最多只有 216=65536 种,检查也只需要检查 16 个格子每个周围至多 9 个格子,效率完全可以接受。 #include <bitset> #include <iostream> #include <array> using namespace std; int Cnt(int x, int y, int cur) { int res = 0; for (int i = max(0, x - 1); i < min(4, x + 2); i++) { for (int j = max(0, y - 1); j...