回收站选址
问题描述
试题编号: 201912-2
试题名称: 回收站选址
时间限制: 1.0s
内存限制: 512.0MB
满分代码:
#encoding:utf-8
"""
reference:http://118.190.20.162/view.page?gpid=T99
Author:Hanger
"""
def getScore(List,trash,scores):
#首先得满足条件二,才能计算分数
score = 0
i = List[0]
j = List[1]
if [i-1,j] in trash and [i+1,j] in trash and [i,j-1] in trash and [i,j+1] in trash:
#[i,j]满足条件,开始计算对角个数
score+=trash.count([i+1,j+1])+trash.count([i+1,j-1])\
+trash.count([i-1,j+1])+trash.count([i-1,j-1])
scores[score]+=1
else:
return 0
n = eval(input())
trash = []
scores = [0 for i in range(5)]
for i in range(n):
trash.append(list(map(int,input().split())))
for i in range(len(trash)):
getScore(trash[i],trash,scores)
for i in scores:
print(i)