自己写的。C语言。题解 | #记负均正II#
记负均正II
https://www.nowcoder.com/practice/64f6f222499c4c94b338e588592b6a62
#include<stdio.h>
int main() {
    int count_fu = 0, count_zheng = 0, temp;
    float sum = 0;
    while (scanf("%d", &temp) != EOF) {
        if (temp < 0) {
            count_fu++;
        } else {
            sum += temp;
            count_zheng++;
        }
    }
    printf("%d\n", count_fu);
    if (count_zheng == 0) {
        printf("0.0\n");
    } else {
        sum = sum / count_zheng;
        printf("%.1f\n", sum);
    }
    return 0;
}
