试题
代码
n
= int(input())
dict = {}
for i
in range(n
):
x
, y
= [int(m
) for m
in input().split
()]
dict[(x
, y
)] = 'true'
dict1
= {}
for key
in dict.keys
():
x
, y
= key
[0], key
[1]
if dict.get
((x
, y
-1)) == dict.get
((x
, y
+1)) == dict.get
((x
-1, y
)) == dict.get
((x
+1, y
)) == 'true':
dict1
[(x
, y
)] = 'true'
if len(dict1
) == 0:
print(0)
print(0)
print(0)
print(0)
print(0)
else:
list = [0]*5
for key
in dict1
.keys
():
x
, y
= key
[0], key
[1]
score
= 0
if dict.get
((x
-1, y
-1)) == 'true':
score
+= 1
if dict.get
((x
-1, y
+1)) == 'true':
score
+= 1
if dict.get
((x
+1, y
-1)) == 'true':
score
+= 1
if dict.get
((x
+1, y
+1)) == 'true':
score
+= 1
list[score
] += 1
for i
in range(5):
print(list[i
])
转载请注明原文地址:https://tech.qufami.com/read-4675.html