CCF试题编号: 201912-2 试题名称: 垃圾回收站
题目我这里不放了,官网都有,主要是我,懒;
思路我也不写了,懒;
看不懂再问吧,稍微有意思的题目我再说说思路,接下来放代码。
这道题的重点是:点个点赞,收藏,转个分享,打赏更棒哟
def main():
N = int(input())
coordination = list()
standar_coordination = list()
score = [0]*5
for _ in range(N): # 记录坐标
row = input()
row = list(map(int, row.split()))
coordination.append((row[0],row[1]))
for (x,y) in coordination: # 找到符合要求的坐标点
if ((x+1,y) in coordination) and ((x-1,y) in coordination) and ((x,y+1) in coordination) and ((x,y-1) in coordination):
standar_coordination.append((x,y))
for (x,y) in standar_coordination: # 打分
count = 0
if (x+1,y+1) in coordination:
count += 1
if (x-1,y-1) in coordination:
count += 1
if (x+1,y-1) in coordination:
count += 1
if (x-1,y+1) in coordination:
count += 1
score[count] += 1
for i in score:
print(i)
if __name__ == '__main__':
main()