3 Star 11 Fork 2

Shanire/OJCode

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
B4040.cpp 1010 Bytes
一键复制 编辑 原始数据 按行查看 历史
Shanire 提交于 2024-10-05 16:29 +08:00 . GESP
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int a[105][105], z[5][5] = {{0, 0, 0, 0}, {0, 1, 1, 0}, {0, 1, 1, 0}, {0, 0, 0, 0}};
int main()
{
int t;
cin >> t;
while (t--)
{
int n, m, res = 0;
cin >> n >> m;
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= m; j++)
{
char c;
cin >> c;
a[i][j] = c - '0';
}
}
for (int i = 1; i + 3 <= n && !res; i++)
{
for (int j = 1; j + 3 <= m && !res; j++)
{
int ok = 1;
for (int x = 0; x < 4 && ok; x++)
{
for (int y = 0; y < 4 && ok; y++)
{
ok = (a[i + x][j + y] == z[x][y]);
}
}
res = max(res, ok);
}
}
cout << (res ? "Yes" : "No") << endl;
}
return 0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/shanire/OJCode.git
git@gitee.com:shanire/OJCode.git
shanire
OJCode
OJCode
main

搜索帮助