题解 | #记负均正#
记负均正
https://www.nowcoder.com/practice/6abde6ffcc354ea1a8333836bd6876b8
import java.util.Scanner;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// 注意 hasNext 和 hasNextLine 的区别
int a=in.nextInt();
int sum=0;
int count=0;
int b=0;
int countz=0;
while(in.hasNext()){
b=in.nextInt();
if(b<0){
count++;
}else if(b>0){
sum+=b;
countz++;
}
}
if(countz==0){
countz=1;
}
System.out.print(count+" ");
System.out.printf("%.1f",(double)sum/countz);
}
}

