You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
561 B
C++
20 lines
561 B
C++
#define _CRT_SECURE_NO_WARNINGS
|
|
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
|
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
char a[512][512];
|
|
int main()
|
|
{
|
|
int n;
|
|
scanf("%d", &n);
|
|
for (int i = 1; i <= n; i++)
|
|
scanf("%s", a[i] + 1);
|
|
int cnt = 0;
|
|
for (int i = 1; i <= n; i++)
|
|
for (int j = 1; j <= n; j++)
|
|
if (a[i][j] == 'X' && a[i - 1][j - 1] == 'X' && a[i - 1][j + 1] == 'X' && a[i + 1][j - 1] == 'X' && a[i + 1][j + 1] == 'X')
|
|
cnt++;
|
|
printf("%d", cnt);
|
|
return 0;
|
|
}
|