题解 | #记负均正#
记负均正
http://www.nowcoder.com/practice/6abde6ffcc354ea1a8333836bd6876b8
思路
遍历。
代码
while True: try: n = int(input()) s = list(map(int, input().strip().split())) c = 0 v = 0 sum = 0 for i in s: if i<0: c += 1 elif i>0: v += 1 sum += i print(str(c)+" "+f"{sum/v:.1f}") except: break