CF1622A.Construct a Rectangle
入门
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
There are three sticks with integer lengths l1,l2 and l3.
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.
有三根长度为整数 l1,l2 和 l3 的木棍。
你需要恰好将其中一根木棍断开成两段,使得:
- 两段的长度均为正整数(严格大于 0);
- 两段长度之和等于该木棍的原始长度;
- 用得到的四根木棍可以构成一个矩形,且每根木棍恰好作为矩形的一条边。
正方形也被视为矩形。
请判断是否可行。
输入格式
The first line contains a single integer t (1≤t≤104) — the number of testcases.
The only line of each testcase contains three integers l1,l2,l3 (1≤li≤108) — the lengths of the sticks.
第一行包含一个整数 t(1≤t≤104)——测试用例的数量。
每个测试用例仅有一行,包含三个整数 l1,l2,l3(1≤li≤108)——木棍的长度。
输出格式
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).
对于每组测试数据,如果可以将其中一根木棍切成两段(每段长度均为正整数),使得最终得到的四根木棍能够构成一个矩形,则输出 “YES”;否则输出 “NO”。
你可以以任意大小写形式输出每个字母(例如,字符串 yEs、yes、Yes 和 YES 均被视为肯定回答)。
输入输出样例
输入#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.
在第一个测试用例中,第一根木棍可以被折断为长度分别为 1 和 5 的两段。我们可以构造一个对边长度分别为 1 和 5 的矩形。
在第二个测试用例中,折断长度为 2 的木棍只能得到长度为 1,1,2,5 的四根木棍,无法构成矩形;折断长度为 5 的木棍可得到 2,3 或 1,4,但这两种情况均无法构成矩形。
在第三个测试用例中,第二根木棍可以被折断为长度均为 2 的两段。由此得到的矩形对边长度均为 2(即一个正方形)。
在第四个测试用例中,第三根木棍可以被折断为长度均为 2 的两段。由此得到的矩形对边长度分别为 2 和 5。
输入解题思路,AI测评打分。不知道怎么写?