题解 | #记负均正#
记负均正
http://www.nowcoder.com/practice/6abde6ffcc354ea1a8333836bd6876b8
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double sum = 0;
int cntf = 0;
int cntz = 0;
while (in.hasNextInt()) {
int a = in.nextInt();
int[] arr = new int[a];
for(int i = 0; i<a; i++){
arr[i] = in.nextInt();
if(arr[i]>0){
sum += arr[i];
cntz++;
}else if(arr[i]<0){
cntf++;
}
}
System.out.print(cntf+" "+String.format("%.1f",(sum>0?(sum/cntz):sum)));
}
}
}