#P0288. Three Decks
Three Decks
题目描述
Monocarp placed three decks of cards in a row on the table. The first deck consists of cards, the second deck consists of cards, and the third deck consists of cards, with the condition .
Monocarp wants to take some number of cards (at least one, but no more than ) from the third deck and distribute them between the first two decks so that each of the taken cards ends up in either the first or the second deck. It is possible that all the cards taken from the third deck will go into the same deck.
Your task is to determine whether Monocarp can make the number of cards in all three decks equal using the described operation.
输入格式
The first line contains a single integer ( ) — the number of test cases.
The only line of each test case contains three integers , and ( ) — the number of cards in the first, second, and third decks, respectively.
Additional constraint on the input: .
输出格式
For each test case, output "YES" (without quotes) if Monocarp can make the number of cards in all three decks equal using the described operation. Otherwise, output "NO" (without quotes).
输入输出样例 #1
输入 #1
4
3 5 10
12 20 30
3 5 7
1 5 6
输出 #1
YES
NO
YES
NO
说明/提示
In the first test case, Monocarp has to take cards from the third deck, put cards in the first deck, and card in the second deck. Thus, there will be cards in all three decks.
In the second test case, it is impossible to make the number of cards in all three decks equal.
In the third test case, Monocarp has to take cards from the third deck and put both in the first deck. Thus, there will be cards in all three decks.
In the fourth test case, it is also impossible to make the number of cards in all three decks equal.