文章目录
201912-2 回收站选址
1. 题目介绍
- 本题网址:http://118.190.20.162/view.page?gpid=T99
- 本题截图:





2. Python代码
n = int(input())
I = [0]*n
H = []
C = []
for i in range(n):
I[i] = list(map(int, input().split()))
for i in range(n):
x=I[i][0]
y=I[i][1]
if [x+1,y] in I and [x,y+1] in I and [x-1,y] in I and [x,y-1] in I:
H.extend([I[i]])
for h in H:
count = 0
x = h[0]
y = h[1]
if [x+1,y+1] in I:
count += 1
if [x+1,y-1] in I:
count += 1
if [x-1,y-1] in I:
count += 1
if [x-1,y+1] in I:
count += 1
C.extend([count])
print(C.count(0))
print(C.count(1))
print(C.count(2))
print(C.count(3))
print(C.count(4))
3.测试结果:

- 总结:小白刚刚接触csp,若代码算法关于简单,过于暴力望谅解