-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11244.cpp
More file actions
39 lines (38 loc) · 1.11 KB
/
11244.cpp
File metadata and controls
39 lines (38 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* ____
* ____ ___ ____ ________ __/ __/
* / __ `__ \/ __ `/ ___/ / / / /_
* / / / / / / /_/ / / / /_/ / __/
* /_/ /_/ /_/\__,_/_/ \__,_/_/
*
* @link : https://the-redback.com
*/
#include <bits/stdc++.h>
using namespace std;
int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy[] = {-1, 0, 1, -1, 1, -1, 0, 1};
int main() {
char a[200][200];
int n, m;
while (scanf("%d %d", &n, &m) == 2) {
if (n == 0 && m == 0) return 0;
getchar();
for (int i = 0; i < n; i++) gets(a[i]);
int count = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (a[i][j] == '*') {
int flag = 0;
for (int k = 0; k < 8; k++) {
int x = i + dx[k];
int y = j + dy[k];
if (x >= 0 && y >= 0 && x < n && y < m && a[x][y] == '*') flag = 1;
}
if (flag == 0) count++;
}
}
}
printf("%d\n", count);
}
return 0;
}