监护室每小时测量一次病人的血压,若收缩压在90 - 140之间并且舒张压在60 - 90之间(包含端点值)则称之为正常,现给出某病人若干次测量的血压值,计算病人正常血压的总时长。
输入格式:
第一行为一个正整数n,n < 100 其后有n行,每行2个正整数,分别为一次测量的收缩压和舒张压,中间以一个空格分隔
输出格式:
输出为血压正常的总时长。
输入样例:
4
100 80
90 50
120 60
140 90
输出样例:
3
n = int(input())
total = 0
maxtotal = 0
for i in range(n):
s = input().split()
a = int(s[0])
b = int(s[1])
if 90<= a <= 140 and 60<= b <= 90:
total += 1
if maxtotal <= total:
maxtotal = total
else:
total = 0
print(maxtotal)
n = int(input())
cnt=0
maxhour = 0
for i in range(n):
a,b=map(int,input().split())
if 90<=a<=140 and 60<=b<=90:
cnt+=1
maxhour=max(maxhour,cnt)
else:
cnt=0
print(maxhour)