-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1895.cpp
50 lines (45 loc) · 885 Bytes
/
1895.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
// 1895. 필터
// 2022.06.25
// 브루트포스
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int v[41][41];
int main()
{
int r, c;
cin >> r >> c;
for (int i = 0; i < r; i++)
{
for (int j = 0; j < c; j++)
{
cin >> v[i][j];
}
}
int ans = 0;
int t;
cin >> t;
vector<int> nums;
for (int i = 0; i < r - 2; i++)
{
for (int j = 0; j < c - 2; j++)
{
nums.clear();
for (int x = i; x < i + 3; x++)
{
for (int y = j; y < j + 3; y++)
{
nums.push_back(v[x][y]);
}
}
sort(nums.begin(), nums.end());
if (nums[4] >= t)
{
ans++;
}
}
}
cout << ans << endl;
return 0;
}