一、分析
若能把数目较多的那种糖果两两依次用数目较少的糖果隔开,则不会吃同样的糖果了
二、代码
#include <bits/stdc++.h>
using namespace std;
int main(){
priority_queue<int> q;
int n;
cin>>n;
int total=0;
int nn=n;
while(nn--){
int x;
cin>>x;
total+=x;
q.push(x);
}
if(total-q.top()>=q.top()-1)cout<<"Yes";
else cout<<"No";
return 0;
}