题解 | #记负均正#
记负均正
https://www.nowcoder.com/practice/6abde6ffcc354ea1a8333836bd6876b8
#include <stdio.h> int main() { int a = 0; int b = 0; int m; double ave = 0.0; int n; scanf("%d", &n); while (n--) { // 注意 while 处理多个 case scanf("%d", &m); if (m > 0){ ave += m; a++; }else if (m < 0){ b++; } } if (a != 0){ ave /= a; } printf("%d %.01lf", b, ave); return 0; }