最大组的成员数量,小于等于总人数一半即可:
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"); } }