天天看點

Finding the Order

點我去看原題

解題思路

這道題需要找到特殊情況

即:可以通過判斷△ACD是否屬于等腰三角形,進而通過判斷各邊的長度得到C,D的方位是在左邊還是右邊

Input

2

3 5 5 3

5 3 3 5

Output

AB//CD

AB//DC

AC代碼

#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
    int t;
    cin>>t;
    while(t--)
    {
        int ac,ad,bc,bd;
        cin>>ac>>ad>>bc>>bd;
		//特況是ACD 可能構成等腰三角形
        if(ac != ad)//ACD 非等腰
        {
            if(ac > ad)
                cout<<"AB//DC"<<endl;
            else
                cout<<"AB//CD"<<endl;
        }
        else//ACD 等腰
        {
            if(bc > bd)
                cout<<"AB//CD"<<endl;
            else
                cout<<"AB//DC"<<endl;
        }
    }
	return 0;
}
           

繼續閱讀