记负均正

记负均正

http://www.nowcoder.com/questionTerminal/6abde6ffcc354ea1a8333836bd6876b8

import java.util.Scanner;


public class Main{

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int n = sc.nextInt();
            int count1 = 0;
            int count2 = 0;
            int sum = 0;
            int in = 0;

            for(int i = 0; i < n; i++){
                in  = sc.nextInt();
                if(in > 0){
                    count1++;
                    sum += in;
                }else if(in < 0){
                    count2++;
                }
            }
            System.out.printf("%d %.1f\n",count2, (sum * 1.0 / count1));
        }
    }    
}
全部评论

相关推荐

2025-12-22 16:31
已编辑
桂林电子科技大学 Python
很奥的前端仔:如果你接了offer 临时又说不去 hr确实要多做一些工作。 当然如果是接offer之前当我没说
点赞 评论 收藏
分享
评论
2
2
分享

创作者周榜

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