救(玄关)
  • 板块学术版
  • 楼主Yuexingfei_qwq
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/7/21 14:12
  • 上次更新2024/7/21 15:25:24
查看原帖
救(玄关)
1125939
Yuexingfei_qwq楼主2024/7/21 14:12

题
暴力枚举,样例不过,球调

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef string str;
const int n = 9;

char a[20][20];

inline int f(const int &x, const int &y, const int &n, const int &m) {
	return abs(x - n) + abs(y - m);
}

int main() {
	for (int i = 1; i <= n; i++) {
		scanf ("%s", a[i] + 1);
	}
	int ans = 0;
	for (int x1 = 1; x1 <= n; x1++) {
		for (int Y1 = 1; Y1 <= n; Y1++) {
			if (a[x1][Y1] == '#') {
				for (int x2 = x1; x2 <= n; x2++) {
					for (int y2 = Y1 + 1; y2 <= n; y2++) {
						if (a[x2][y2] == '#') {
							for (int x3 = x2; x3 <= n; x3++) {
								for (int y3 = y2 + 1; y3 <= n; y3++) {
									if (a[x3][y3] == '#') {
										for (int x4 = x3; x4 <= n; x4++) {
											for (int y4 = y3 + 1; y4 <= n; y4++) {
												if (a[x4][y4] == '#') {
													if (f(x1, Y1, x2, y2) == f(x2, y2, x3, y3) && f(x2, y2, x3, y3) == f(x3, y3, x4, y4) && f(x3, y3, x4, y4) == f(x4, y4, x1, Y1)) {
														ans++;
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
	printf ("%d\n", ans);
	return 0;
}
2024/7/21 14:12
加载中...