【洛谷】P3717 [AHOI2017初中组]cover 【python】
1.题意
2.分析
3.代码
import math
N=105
arr = [[0 for i in range(N)] for i in range(N)]
def readToArray():
s=input()
nums = s.strip().split()
nums = [int(num) for num in nums]
return nums
def judge(li):
cnt = 0
for i in range(1, n + 1):
for j in range(1, n + 1):
for k in li:
x,y = k[0:2]
dis = (x-i)*(x-i) + (y-j)*(y-j)
dis = math.sqrt(dis)
if dis<=r and arr[i][j] == 0:
arr[i][j] = 1
cnt += 1
print(cnt)
n, m, r = readToArray()[0:3]
li = []
for i in range(m):
x,y=readToArray()[0:2]
li.append((x,y))
judge(li)