分组批卷

改考卷

http://www.nowcoder.com/questionTerminal/be65e76a8b394139982047b2b0cec415

最大组的成员数量,小于等于总人数一半即可:

import java.util.*;
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(), mx = Integer.MIN_VALUE, sum = 0;
        for(int i = 0; i < a; ++i){
            int n = sc.nextInt();
            sum += n;
            if(mx < n) mx = n;
        }
        if(mx <= sum/2){
            System.out.println("Yes");
            return;
        }
        System.out.println("No");
    }
}
全部评论

相关推荐

1 收藏 评论
分享
牛客网
牛客企业服务