time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
There are three sticks with integer lengths l1,l2l1,l2 and l3l3.
You are asked to break exactly one of them into two pieces in such a way that:
A square is also considered a rectangle.
Determine if it's possible to do that.
Input
The first line contains a single integer tt (1≤t≤1041≤t≤104) — the number of testcases.
The only line of each testcase contains three integers l1,l2,l3l1,l2,l3 (1≤li≤1081≤li≤108) — the lengths of the sticks.
Output
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).
Example
input
Copy
4 6 1 5 2 5 2 2 4 2 5 5 4
output
Copy
YES NO YES YES
Note
In the first testcase, the first stick can be broken into parts of length 11 and 55. We can construct a rectangle with opposite sides of length 11 and 55.
In the second testcase, breaking the stick of length 22 can only result in sticks of lengths 1,1,2,51,1,2,5, which can't be made into a rectangle. Breaking the stick of length 55 can produce results 2,32,3 or 1,41,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 22 and 22. The resulting rectangle has opposite sides 22 and 22 (which is a square).
In the fourth testcase, the third stick can be broken into parts of length 22 and 22. The resulting rectangle has opposite sides 22 and 55.
解题说明:此题是一道几何题,简单分析就知道如果要构成矩形,一种情况是两个数之和等于第三个数,这样把第三个数拆分即可。另一种情况是其中两个数相等,第三个数能被2整除,这样只需要把第三个数对半拆即可。
#include<stdio.h>
int main()
{
int t;
scanf("%d", &t);
while (t--)
{
int l, m, n;
scanf("%d %d %d", &l, &m, &n);
if (l == m + n || m == l + n || n == l + m || (l == m && n % 2 == 0) || (l == n && m % 2 == 0) || (m == n && l % 2 == 0))
{
printf("YES\n");
}
else
{
printf("NO\n");
}
}
return 0;
}