2020牛客暑期多校训练营(第四场)F Finding the Order

题目描述
ZYB has a so-called smart brain: He can always point out the keypoint in a complex problem.

There are two parallel lines AB and CD in a plane. {A,B,C,D}A,B,C,D are all distinct points.
You only know the Euclidean Distances between {AC,AD,BC,BD}AC,AD,BC,BD. but you don’t know the exact order of points. (i.e. You don’t know whether it’s AB \parallel CDAB∥CD or AB \parallel DCAB∥DC).

Could you determine the order of points quickly, like the ZYB does?
输入描述:
The input contains multiple cases. The first line of the input contains a single integer T\ (1 \le T \le 100)T (1≤T≤100), the number of cases.
For each case, there are four integers a,b,c,d(1 \le a,b,c,d \le 1000)a,b,c,d(1≤a,b,c,d≤1000) in a line, indicating the distances between {AC,AD,BC,BD}AC,AD,BC,BD.
It is guaranteed that each case corresponds to a valid solution.
输出描述:
For each case, output ‘AB//CD’ (Quotation marks) if AB \parallel CDAB∥CD, or output ‘AB//DC’ (Quotation marks) if AB \parallel DCAB∥DC.
示例1
输入
复制
2
3 5 5 3
5 3 3 5
输出
复制
AB//CD
AB//DC

题意:
给定ABCD四个点之间连线的距离,判断AB//CD还是AB//DC的有向平行
可以从分析中垂线开始 然后发现固定两边大小其余两边的大小变化只有唯一的结果


int main()
{
    int t=read();
    while(t--){
        int ac,ad,bc,bd;
        int a,b,c,d;
        cin>>ac>>ad>>bc>>bd;
         if (bc == bd)
        {
            if (ad > ac) cout<<"AB//CD"<<endl;
            else cout<<"AB//DC"<<endl;
        }
        else if (bd > bc)
        {
            if (ad > ac)cout<<"AB//CD"<<endl;
            else cout<<"AB//DC"<<endl;
        }
        else
        {
            if (ac > ad) cout<<"AB//DC"<<endl;
            else cout<<"AB//CD"<<endl;
        }
    }
    return 0;
}


你可能感兴趣的:(2020牛客暑期多校训练营(第四场)F Finding the Order)