牛客华为机试HJ105
作者:互联网
1. 问题描述
2. Solution
neg_cnt = 0
pos_sum = 0
pos_cnt = 0
while True:
try:
n = int(input().strip())
if n < 0:
neg_cnt += 1
elif n > 0:
pos_sum += n
pos_cnt += 1
except:
break
print(neg_cnt)
if pos_cnt:
print(round(pos_sum / pos_cnt, 1))
else:
print(0.0)
标签:cnt,neg,sum,pos,牛客,elif,print,机试,HJ105 来源: https://www.cnblogs.com/junstat/p/16181413.html