csp202009-2风险人群筛查
代码如下
#202009-2
#输入第一行
n,k,t,x1,y1,x2,y2 = map(int,input().split(' '))
num_pass = 0#经过高危区域的人数
num_stay = 0#在高危地区逗留的人数
for i in range(n):
count_in = 0
count = []
x, y = [], []
s = input()
s = s.split(' ')
#居民位置记录
for j in range(2*t):
if j%2 ==0:
x.append(int(s[j]))
else:
y.append(int(s[j]))
# 判断居民t个位置坐标是否在高位区域内,是=>1,否=>0
for j in range(t):
if x1<=x[j]<=x2 and y1<=y[j]<=y2:
count.append(1)
else:
count.append(0)
#判断是否逗留
for m in count:
if count_in<k:
if m ==1:
count_in +=1
else:
count_in = 0
if count_in>=k:
num_stay += 1
#判断是否经过
if 1 in count:
num_pass +=1
#输出
print(num_pass)
print(num_stay)