题解 | #记负均正#

记负均正

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

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务