#P0288. Three Decks

    传统题 1000ms 256MiB 显示标签>Codeforces

Three Decks

题目描述

Monocarp placed three decks of cards in a row on the table. The first deck consists of a a cards, the second deck consists of b b cards, and the third deck consists of c c cards, with the condition a<b<c a < b < c .

Monocarp wants to take some number of cards (at least one, but no more than c c ) 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 t t ( 1t104 1 \le t \le 10^4 ) — the number of test cases.

The only line of each test case contains three integers a,b a, b , and c c ( 1a,b,c108 1 \le a, b, c \le 10^8 ) — the number of cards in the first, second, and third decks, respectively.

Additional constraint on the input: a<b<c a < b < c .

输出格式

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 4 4 cards from the third deck, put 3 3 cards in the first deck, and 1 1 card in the second deck. Thus, there will be 6 6 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 2 2 cards from the third deck and put both in the first deck. Thus, there will be 5 5 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.