BestCoder Round #78 1001/ hdu 5655 CA Loves Stick

题意:给出一个四根木棍的长度,判断是否能组成四边形。

最长边小于三边和来判断四边形。坑点在于数据,可能出现长度为0的边,而且数据太大,三个数相加会超过longlong范围,要用减法。(这题居然wa了半个小时,死亡)

#include <iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>

using namespace std;

unsigned long long a[10];

int main()
{
    int T;
    cin>>T;
    while(T--)
    {
        bool flag=1;
        for(int i=0;i<4;i++)
        {
            cin>>a[i];
            if(a[i]==0) flag=0;
        }
        sort(a,a+4);
        if(a[0]+a[1]>a[3]-a[2]&&flag)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}


你可能感兴趣的:(round,bc,HDU,水题,BestCoder)