题解 | #记负均正#
记负均正
https://www.nowcoder.com/practice/6abde6ffcc354ea1a8333836bd6876b8
while True:
try:
n = int(input())
pos = []
neg = []
s = input().split(' ')
for item in s:
if int(item) > 0:
pos.append(int(item))
elif int(item) < 0:
neg.append(int(item))
if pos == []:
print(len(neg), 0.0)
else:
print(len(neg), round(sum(pos)/len(pos),1))
except:
break


查看4道真题和解析