309086: CF1622A. Construct a Rectangle

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Construct a Rectangle

题意翻译

有三根长度分别为整数 $l_1$,$l_2$ 和 $l_3$ 的木棍。 需要你把其中一个完全分成两部分,要求如下: - 两部分长度均为正整数;(即必须大于 $0$) - 两部分的总长度等于原木棍的长度; - 可以用得到的四根木棍组成一个矩形,每部分作为矩形的一条边。 正方形也被视作矩形。 你需要输出是否存在这样的方案。 ### 输入 第一行为 $t(1\leqslant t\leqslant10^4)$,代表数据组数。 每组数据输入三个整数,分别为 $l_1,l_2,l_3 (1\leqslant l_i\leqslant10^8)$,代表三根木棍的长度。 ### 输出 对于每组数据,如果可以把其中一根木棍分成两部分且长度为正整数,并且这四部分可以组成一个矩形的话,就输出 `YES`,否则就输出 `NO`。 不区分大小写(如 `yEs`, `yes`, `Yes` 或者 `YES` 都被认为是 `YES`)。 ### 样例 #### 输入 ```plain 4 6 1 5 2 5 2 2 4 2 5 5 4 ``` #### 输出 ```plain YES NO YES YES ``` ### 提示 第一组数据中,我们可以把第一根木棍分割成 $1$ 和 $5$。从而构造一个长宽分别为 $5$ 和 $1$ 的矩形。 第二组数据中,把长度为 $2$ 的木棍分割开只能得到长度为 $1,1,2,5$ 的木棍,不能将其做成矩形。分割长度为 $5$ 的木棍可以得到 $2,3$ 或 $1,4$ 的木棍,但它们都不能构成一个矩形。 第三组数据中,第二根木棍可以分成长度为 $2$ 和 $2$ 的部分。构成的矩形的边长为 $2$(即正方形)。 第四组数据中,第三根木棍可以分成长度为 $2$ 和 $2$ 的部分。得到的矩形长宽分别为 $5$ 和 $2$。

题目描述

There are three sticks with integer lengths $ l_1, l_2 $ and $ l_3 $ . You are asked to break exactly one of them into two pieces in such a way that: - both pieces have positive (strictly greater than $ 0 $ ) integer length; - the total length of the pieces is equal to the original length of the stick; - it's possible to construct a rectangle from the resulting four sticks such that each stick is used as exactly one of its sides. A square is also considered a rectangle. Determine if it's possible to do that.

输入输出格式

输入格式


The first line contains a single integer $ t $ ( $ 1 \le t \le 10^4 $ ) — the number of testcases. The only line of each testcase contains three integers $ l_1, l_2, l_3 $ ( $ 1 \le l_i \le 10^8 $ ) — the lengths of the sticks.

输出格式


For each testcase, print "YES" if it's possible to break one of the sticks into two pieces with positive integer length in such a way that it's possible to construct a rectangle from the resulting four sticks. Otherwise, print "NO". You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES are all recognized as a positive answer).

输入输出样例

输入样例 #1

4
6 1 5
2 5 2
2 4 2
5 5 4

输出样例 #1

YES
NO
YES
YES

说明

In the first testcase, the first stick can be broken into parts of length $ 1 $ and $ 5 $ . We can construct a rectangle with opposite sides of length $ 1 $ and $ 5 $ . In the second testcase, breaking the stick of length $ 2 $ can only result in sticks of lengths $ 1, 1, 2, 5 $ , which can't be made into a rectangle. Breaking the stick of length $ 5 $ can produce results $ 2, 3 $ or $ 1, 4 $ but neither of them can't be put into a rectangle. In the third testcase, the second stick can be broken into parts of length $ 2 $ and $ 2 $ . The resulting rectangle has opposite sides $ 2 $ and $ 2 $ (which is a square). In the fourth testcase, the third stick can be broken into parts of length $ 2 $ and $ 2 $ . The resulting rectangle has opposite sides $ 2 $ and $ 5 $ .

Input

题意翻译

有三根长度分别为整数 $l_1$,$l_2$ 和 $l_3$ 的木棍。 需要你把其中一个完全分成两部分,要求如下: - 两部分长度均为正整数;(即必须大于 $0$) - 两部分的总长度等于原木棍的长度; - 可以用得到的四根木棍组成一个矩形,每部分作为矩形的一条边。 正方形也被视作矩形。 你需要输出是否存在这样的方案。 ### 输入 第一行为 $t(1\leqslant t\leqslant10^4)$,代表数据组数。 每组数据输入三个整数,分别为 $l_1,l_2,l_3 (1\leqslant l_i\leqslant10^8)$,代表三根木棍的长度。 ### 输出 对于每组数据,如果可以把其中一根木棍分成两部分且长度为正整数,并且这四部分可以组成一个矩形的话,就输出 `YES`,否则就输出 `NO`。 不区分大小写(如 `yEs`, `yes`, `Yes` 或者 `YES` 都被认为是 `YES`)。 ### 样例 #### 输入 ```plain 4 6 1 5 2 5 2 2 4 2 5 5 4 ``` #### 输出 ```plain YES NO YES YES ``` ### 提示 第一组数据中,我们可以把第一根木棍分割成 $1$ 和 $5$。从而构造一个长宽分别为 $5$ 和 $1$ 的矩形。 第二组数据中,把长度为 $2$ 的木棍分割开只能得到长度为 $1,1,2,5$ 的木棍,不能将其做成矩形。分割长度为 $5$ 的木棍可以得到 $2,3$ 或 $1,4$ 的木棍,但它们都不能构成一个矩形。 第三组数据中,第二根木棍可以分成长度为 $2$ 和 $2$ 的部分。构成的矩形的边长为 $2$(即正方形)。 第四组数据中,第三根木棍可以分成长度为 $2$ 和 $2$ 的部分。得到的矩形长宽分别为 $5$ 和 $2$。

加入题单

算法标签: