题解
如果存在某一条边的 \(a_i>=2*(sum-a_i)\) 那么这条边一定有点剩余无法连接,为什么?这条边上每取两个点作为底边点,就一定能去外面一个点作为顶点,且无交叉(顺时针或逆时针)
code
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ll n;
cin>>n;
ll sum=0,maxs=0;
for(int i=1;i<=n;i++)
{
ll x;
cin>>x;
sum+=x;
maxs=max(maxs,x);
}
if((sum-maxs)*2>=maxs) cout<<sum/3;
else cout<<sum-maxs;
return 0;
}
标签:Triangle,int,maxs,sum,long,Construction,ll
From: https://www.cnblogs.com/pure4knowledge/p/18130882