P1001 A+B Problem s = input().split() print(int(s[0]) + int(s[1])) P1035 [NOIP 2002 普及组] 级数求和 k=int(input()) s=0 n=0 while s<=k: n+=1 s+=1/n print(n) P1046 [NOIP 2005 普及组] 陶陶摘苹果 apple_heights=list(map(int,input().split())) taotao_height=int(input()) x=0 for height in apple_heights: if height<=taotao_height+30: x+=1 print(x) P1047 [NOIP 2005 普及组] 校门外的树 l, m = map(int, input().split()) trees=[True]*(l+1) for _ in range(m): u,v=map(int, input().split()) for i in range(u,v+1): trees[i]=False remain_trees=0 for i in range(0,l+1): if trees[i]==True: remain_trees+=1 print(remain_trees) P1085 [NOIP 2004 普及组] 不高兴的津津 day_hours = [] x = 0 # 循环 7 天,读取每天的学习时间 while x < 7: a, b = map(int, input().split()) # 将每天的学习总时间添加到列表中 day_hours.append(a + b) x += 1 # 初始化最大学习时间和对应的天数 max_day = day_hours[0] max_index = 0 i = 0 # 遍历列表,找出最大学习时间和对应的天数 while i < 7: if day_hours[i] > max_day: max_day = day_hours[i] max_index = i i += 1 # 如果最大学习时间大于 8 小时,输出对应的天数(从 1 开始) if max_day > 8: print(max_index + 1) else: print(0)