File tree Expand file tree Collapse file tree 1 file changed +33
-5
lines changed Expand file tree Collapse file tree 1 file changed +33
-5
lines changed Original file line number Diff line number Diff line change 1
- // Authored by : BaaaaaaaaaaarkingDog
1
+ // Authored by : cpprhtn
2
2
// Co-authored by : -
3
- // http://boj.kr/****************
3
+ // http://boj.kr/8882cceb247049b18599a0b2847540b8
4
4
#include < bits/stdc++.h>
5
5
using namespace std ;
6
6
7
- int main (void ){
7
+ int N;
8
+ int paper[2200 ][2200 ];
9
+ int cnt[3 ]; // -1, 0, 1로 채워진 종이 갯수
10
+
11
+ // 해당 종이 내부에 같은 숫자로만 채워졌는지 확인하는 함수
12
+ bool check (int x, int y, int n) {
13
+ for (int i = x; i < x + n; i++)
14
+ for (int j = y; j < y + n; j++)
15
+ if (paper[x][y] != paper[i][j])
16
+ return false ;
17
+ return true ;
18
+ }
19
+ void solve (int x, int y, int z)
20
+ {
21
+ if (check (x, y, z)) {
22
+ cnt[paper[x][y] + 1 ] += 1 ;
23
+ return ;
24
+ }
25
+ int n = z / 3 ;
26
+ for (int i = 0 ; i < 3 ; i++)
27
+ for (int j = 0 ; j < 3 ; j++)
28
+ solve (x + i * n, y + j * n, n);
29
+ }
30
+ int main (void ) {
8
31
ios::sync_with_stdio (0 );
9
32
cin.tie (0 );
10
-
11
- }
33
+ cin >> N;
34
+ for (int i = 0 ; i < N; i++)
35
+ for (int j = 0 ; j < N; j++)
36
+ cin >> paper[i][j];
37
+ solve (0 , 0 , N);
38
+ for (int i = 0 ; i < 3 ; i++) cout << cnt[i] << " \n " ;
39
+ }
You can’t perform that action at this time.
0 commit comments