2020牛客暑期多校训练营(第四场)F题
链接: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).
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");
}
}
上一篇: Redis远程连接Redis Server提示服务器关闭了连接
下一篇: 常见CentOS操作命令
推荐阅读
-
2020牛客暑期多校训练营(第四场)——Basic Gcd Problem
-
2020牛客暑期多校训练营(第五场)
-
2020牛客暑期多校训练营(第九场) The Flee Plan of Groundhog
-
2020牛客暑期多校训练营Groundhog and Apple Tree(树形dp,贪心)
-
2020暑期牛客多校训练营第九场(K)The Flee Plan of Groundhog(lca,树形dp)
-
2020牛客暑期多校训练营(第二场)Cover the Tree
-
2020牛客暑期多校训练营(第一场)H-Minimum-cost Flow
-
2020牛客暑期多校 第一场 F Infinite String Comparision(字符串)
-
Harmony Pairs 2020牛客暑期多校训练营(第六场)
-
2020牛客暑期多校训练营(第五场)解题报告DEFI