A14843 | Construct a Rectangle
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
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).
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$ .
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$ .
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted