2020牛客暑期多校训练营(第四场)F
Ancient Distance
https://ac.nowcoder.com/acm/contest/5669/A
题目描述
ZYB has a so-called smart brain. He can always point out the key-point in a complex problem.
There are two parallel lines and in a plane. are all distinct points.
You only know the Euclidean Distances between . But you don't know the exact order of points (i.e. You don't know whether it's or ).
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 , the number of cases.
For each case, there are four integers in a line, indicating the distances between .
It is guaranteed that each case corresponds to a valid solution.
输出描述
For each case, output AB//CD
(Quotation marks) if , or output AB//DC
(Quotation marks) if .
示例1
输入
2 3 5 5 3 5 3 3 5
输出
AB//CD AB//DC
分析
由三角形三边关系,,,故 。
当 ,有 。
当 ,有 。
找到了完全相反的两个结论,可以作为判断的依据。
代码
/****************************************************************** Copyright: 11D_Beyonder All Rights Reserved Author: 11D_Beyonder Problem ID: 2020牛客暑期多校训练营(第四场) Problem F Date: 8/15/2020 Description: Computational Geometry *******************************************************************/ #include<iostream> #include<cstdio> using namespace std; int main(){ int _; for(cin>>_;_;_--){ int AC,AD,BC,BD; scanf("%d%d%d%d",&AC,&AD,&BC,&BD); puts(AD+BC>AC+BD?"AB//CD":"AB//DC"); } return 0; }
收集牛客暑期多校训练营的题解