-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2897.cpp
63 lines (55 loc) · 1.25 KB
/
2897.cpp
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// 2897. 몬스터 트럭
// 2021.11.02
// 브루트포스
#include<iostream>
#include<string>
using namespace std;
string s[51];
int ans[5];
int main()
{
int r, c;
cin >> r >> c;
for (int i = 0; i < r; i++)
{
cin >> s[i];
}
for (int i = 0; i < r; i++)
{
for (int j = 0; j < c; j++)
{
if (i < r - 1 && j < c - 1)
{
int breakCount = 0;
// 빌딩 체크
if (s[i][j] == '#' or s[i][j + 1] == '#' or s[i + 1][j] == '#' or s[i + 1][j + 1] == '#')
{
continue;
}
// 주차된 차 체크
if (s[i][j] == 'X')
{
breakCount++;
}
if (s[i + 1][j] == 'X')
{
breakCount++;
}
if (s[i][j + 1] == 'X')
{
breakCount++;
}
if (s[i + 1][j + 1] == 'X')
{
breakCount++;
}
ans[breakCount]++;
}
}
}
for (int i = 0; i < 5; i++)
{
cout << ans[i] << endl;
}
return 0;
}