F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

NPY and arithmetic progression

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2085    Accepted Submission(s): 678


Problem Description
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?
 

Input
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)$.
 

Output
For each test case,print "Yes"(without quotes) if the numbers can be divided properly,otherwise print "No"(without quotes).
 

Sample Input
3 1 2 2 1 1 0 0 0 3 0 0 0
 

Sample Output
Yes No Yes
 

Hint
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}.
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-06-23 10:00:28, Gzip enabled