-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1780.py
More file actions
44 lines (35 loc) · 873 Bytes
/
Copy path1780.py
File metadata and controls
44 lines (35 loc) · 873 Bytes
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
# 1780 종이의 개수
n = int(input())
paper = []
for i in range(n):
paper.append(list(map(int, input().split())))
minusone = 0
zero = 0
plusone = 0
def isAllSame(x, y, len):
first_val = paper[x][y]
for i in range(len):
for j in range(len):
if paper[x + i][y + j] != first_val:
return 2
return first_val
def divide(x, y, len):
global minusone
global zero
global plusone
isAllSameValue = isAllSame(x, y, len)
if isAllSameValue == 2:
for i in range(3):
for j in range(3):
divide(x + (i * (len // 3)), y + (j * (len // 3)), len // 3)
else:
if isAllSameValue == -1:
minusone += 1
elif isAllSameValue == 0:
zero += 1
else:
plusone += 1
divide(0, 0, n)
print(minusone)
print(zero)
print(plusone)