当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5143:NPY and arithmetic progression

题目描述
NPY is learning arithmetic progression in his math class. In mathematics, an arithmetic progression (AP) is a sequence of numbers such that the difference between the consecutive terms is constant.(from wikipedia)
He thinks it's easy to understand,and he found a challenging problem from his talented math teacher:
You're given four integers, $a_1, a_2, a_3, a_4$, which are the numbers of 1,2,3,4 you have.Can you divide these numbers into some Arithmetic Progressions,whose lengths are equal to or greater than 3?(i.e.The number of AP can be one)
Attention: You must use every number exactly once.
Can you solve this problem?
输入解释
The first line contains a integer T — the number of test cases ($1 \leq T \leq 100000$).
The next T lines,each contains 4 integers $a_1, a_2, a_3, a_4(0 \leq a_1, a_2, a_3, a_4 \leq 10^9)$.
输出解释
For each test case,print "Yes"(without quotes) if the numbers can be divided properly,otherwise print "No"(without quotes).
输入样例
3
1 2 2 1
1 0 0 0
3 0 0 0
输出样例
Yes
No
Yes
提示
In the first case,the numbers can be divided into {1,2,3} and {2,3,4}.
In the second case,the numbers can't be divided properly.
In the third case,the numbers can be divided into {1,1,1}.
来自杭电HDUOJ的附加信息
Recommend heyang

该题目是Virtual Judge题目,来自 杭电HDUOJ

题目来源 BestCoder Round #22

源链接: HDU-5143

最后修改于 2020-10-25T23:20:10+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)