parent
9aa69de219
commit
99f721549e
@ -0,0 +1,30 @@
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
const int N = 31;
|
||||
char a[N][N];
|
||||
int n, m, cnt;
|
||||
int main() {
|
||||
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;
|
||||
}
|
Loading…
Reference in new issue