Educational Codeforces Round 120 (Rated for Div. 2) A. Construct a Rectangle

题目链接:Problem - A - Codeforces

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.

Input

The first line contains a single integer tt (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.

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

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

output

YES
NO
YES
YES

Note

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

题意:给定三个长度的木棍,一个可以拆成两根,能否组成一个矩形

思路:如果最长的等于两根短的之和,那么可以组成,不行的如果有两根相同并且第三根是偶数,也是可以的

#include<bits/stdc++.h>
using namespace std;


int main(){
	ios::sync_with_stdio(false);
	int t;
	cin >> t;
	int a, b, c;
	while(t--){
		cin >> a >> b >> c;
		if(a < b){
			swap(a, b);
		}
		if(b < c){
			swap(b, c);
		}
		if(a < b){
			swap(a, b);
		}
		if(a == b + c){
			cout << "YES" << endl;
		}else{
			if(a == b && c % 2 == 0){
				cout << "YES" << endl;
			}else if(a == c && b % 2 == 0){
				cout << "YES" << endl;
			}else if(b == c && a % 2 == 0){
				cout << "YES" << endl; 
			}else{
				cout << "NO" << endl;
			}
		}
	}
	return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值