欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

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

程序员文章站 2022-06-02 22:23:33
...

链接:https://ac.nowcoder.com/acm/contest/5669/F
来源:牛客网

题目描述

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}A,B,C,D are all distinct points. You only know the Euclidean Distances between AC,AD,BC,BD{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∥CDAB \parallel CDAB∥CD or AB∥DCAB \parallel DCAB∥DC).
2020牛客暑期多校训练营(第四场)F题

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≤T≤100)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≤a,b,c,d≤1000)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}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∥CDAB \parallel CDAB∥CD, or output ‘AB//DC’ (Quotation marks) if AB∥DCAB \parallel DCAB∥DC.

示例1

输入

2
3 5 5 3
5 3 3 5

2
3 5 5 3
5 3 3 5

输出

AB//CD
AB//DC

AB//CD
AB//DC


#pragma warning (disable:4996)
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <string>
#include <cstdio>
#include <cmath>
#include <vector>
#include <queue>
#include <list>
#define inf 0X3f3f3f3f
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main()
{
 int t;
 scanf("%d", &t);
 while (t--)
 {
  int ac, ad, bc, bd;
  scanf("%d%d%d%d", &ac, &ad, &bc, &bd);
  bool ans;//1:CD, 0:DC
  if (ac < bc)//c左
  {
   if (ad < bd)//d左
   {
    if (bc > bd)
     ans = 1;
    else
     ans = 0;
   }
   else//d右
    ans = 1;
  }
  else//c右
  {
   if (ad < bd)//d左
    ans = 0;
   else//d右
   {
    if (ac < ad)
     ans = 1;
    else
     ans = 0;
   }
  }
  if (ans)
   printf("AB//CD\n");
  else
   printf("AB//DC\n");
 }
}
相关标签: acm竞赛