题解 | 记负均正II
import sys cnegative = 0 lother = [] while True: try: n = int(input()) if n < 0: cnegative += 1 else: lother.append(n) except: break print(cnegative) if len(lother) ==0: print(0.0) else: print(round(sum(lother)/len(lother),1))
import sys cnegative = 0 lother = [] while True: try: n = int(input()) if n < 0: cnegative += 1 else: lother.append(n) except: break print(cnegative) if len(lother) ==0: print(0.0) else: print(round(sum(lother)/len(lother),1))
相关推荐