Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
45813 zhouhuanyu 玙静 花坛 C++ 通过 0 MS 252 KB 964 2024-04-20 12:26:02

Tests(1/1):


#include<bits/stdc++.h> using namespace std; const int N = 30; char a[N + 1][N + 1]; int main() { int n, m, cnt = 0; cin >> n >> m; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> a[i][j]; } } for (int e = 2; e <= min(m, n); e++) { for (int i = 0; i <= n - e; i++) { for (int j = 0; j <= m - e; j++) { bool f = true; for (int x = 0; x < e; x++) { for (int y = 0; y < e; y++) { if (a[i][j] != a[i + x][j + y]) { f = false; break; } } if (!f) { break; } } if (f) { cnt++; } } } } cout << cnt; return 0; }


测评信息: