列表

详情


NC208885. FindingtheOrder

描述

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.  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

原站题解

上次编辑到这里,代码来自缓存 点击恢复默认模板

C++11(clang++ 3.9) 解法, 执行用时: 3ms, 内存消耗: 376K, 提交时间: 2020-07-20 12:23:42

#include <cstdio>
int T,a,b,c,d;
int main(){
	scanf("%d",&T);
	while(T--){
		scanf("%d%d%d%d",&a,&b,&c,&d);
		puts(b+c>a+d?"AB//CD":"AB//DC");
	}
}

pypy3 解法, 执行用时: 54ms, 内存消耗: 21136K, 提交时间: 2023-05-02 17:15:38

T = int(input())
for t in range(T):
    ac, ad, bc, bd = map(int, input().split())
    print("AB//CD" if ac + bd < ad + bc else "AB//DC")

Python3(3.5.2) 解法, 执行用时: 16ms, 内存消耗: 3320K, 提交时间: 2020-07-20 17:19:25

for i in range(int(input())):
    ac, ad, bc, bd = map(int, input().split())
    print('AB//CD' if ac + bd < ad + bc else 'AB//DC')

上一题