题解 | #记负均正#
记负均正
http://www.nowcoder.com/practice/6abde6ffcc354ea1a8333836bd6876b8
while True:
try:
int_num = int(input())
num_list = input().split(" ")
num_list_2 = num_list[:int_num]
num_result_1 = 0
num_result_2 = 0
num_result = 0
for i in num_list_2:
if int(i) < 0:
num_result_1 += 1
elif int(i) > 0:
num_result_2 += 1
num_result += int(i)
print("%d %.2f" % (num_result_1, num_result/num_result_2))
except:
break
查看4道真题和解析