题解 | #记负均正II#
记负均正II
https://www.nowcoder.com/practice/64f6f222499c4c94b338e588592b6a62
import sys lines = [] for line in sys.stdin: lines.append(int(line.rstrip('\n'))) # 移除行末的换行符 times=0 nums=[] for num in lines: if num<0: times+=1 else: nums.append(num) if len(nums)!=0: ave=round(sum(nums)/len(nums),1) else: ave=0.0 print(times) print(ave)