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

分析

  由三角形三边关系,,故
3.png
  当 ,有
1.png
  当 ,有
2.png
  找到了完全相反的两个结论,可以作为判断的依据。

代码

/******************************************************************
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;
}
牛客暑期多校训练营题解 文章被收录于专栏

收集牛客暑期多校训练营的题解

全部评论

相关推荐

点赞 评论 收藏
分享
03-12 15:34
已编辑
北京邮电大学 Java
呓语0613:老哥你这黑马点评改造是在哪里看的
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务