20
5 5
#####
#...#
#...#
#....
.....
3 3
###
###
###
5 5
#####
#####
#####
#####
#####
<27002 bytes omitted>
用户输出
5
25
25
25
22
37
5
27
7
57
4
9
0
1
1389
895
915
1
1079
1058
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#21527 | #1010. J. 团队配置,新奇的面试题 | Accepted | 100 | 18 ms | 288 K | C++ 17 / 1.2 K | Leohh | 2020-02-08 1:21:42 |
#include <iostream>
#include <stdio.h>
#include <string.h>
#define MAX_N 55
using namespace std;
int T, N, M, n, m;
char a[MAX_N][MAX_N];
char b[MAX_N][MAX_N];
bool ok(int x, int y) { return 0 <= x && x < N && 0 <= y && y < M; }
int main() {
scanf("%d", &T);
while (T--) {
int ans = 0;
scanf("%d%d", &N, &M);
for (int i = 0; i < N; i++) {
scanf("%s", a[i]);
}
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++) {
scanf("%s", b[i]);
}
for (int i = -(n >> 1); i <= N - ((n + 1) >> 1); i++) {
for (int j = -(m >> 1); j <= M - ((m + 1) >> 1); j++) {
bool flag = true;
for (int x = 0; x < n; x++) {
for (int y = 0; y < m; y++) {
if (ok(i + x, j + y) && a[i + x][j + y] == '#' && b[x][y] == '#') {
flag = false;
break;
}
}
}
if (flag) {
ans++;
}
}
}
printf("%d\n", ans);
}
}