CCF-回收站选址-python3

23 篇文章 0 订阅
'''
是否可以是回收站:
1、该处有垃圾
2、其上下左右有垃圾
对选址评分:对角有几处有垃圾就有几分
求  每种得分的选址数
'''

n = int(input())  # n处垃圾  
laji = []
zero = 0
one = 0
two = 0
three = 0
four = 0
for i in range(n):
    x, y = map(int, input().split())
    laji.append((x, y))
for l in laji:
    x = l[0]
    y = l[1]
    score = 0
    if (x,y+1) in laji and (x,y-1) in laji and (x+1,y) in laji and (x-1,y) in laji:  # 是回收站
        if (x+1,y+1) in laji:
            score += 1
        if (x+1,y-1) in laji:
            score += 1
        if (x-1,y+1) in laji:
            score += 1
        if (x-1,y-1) in laji:
            score += 1
        if score == 0:
            zero += 1
        if score == 1:
            one += 1
        if score == 2:
            two += 1
        if score == 3:
            three += 1
        if score == 4:
            four += 1
print(zero)
print(one)
print(two)
print(three)
print(four)
        

    

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值