#C6215. Equal Bill Split Among Three Friends
Equal Bill Split Among Three Friends
Equal Bill Split Among Three Friends
You are given several test cases. For each test case, there are three integers \(X\), \(Y\), and \(Z\) representing the amounts contributed by three friends. Your task is to determine whether it is possible to equally split the total bill among the three friends.
In other words, if the total amount \(S = X + Y + Z\) is divisible by 3, then the answer is YES
; otherwise, it is NO
.
Note: Each test case is independent.
inputFormat
The input is given via standard input (stdin) and has the following format:
- The first line contains a single integer \(T\), representing the number of test cases.
- Each of the following \(T\) lines contains three space-separated integers \(X\), \(Y\), and \(Z\).
outputFormat
For each test case, output a single line containing YES
if the total \(X+Y+Z\) is divisible by 3, or NO
otherwise.
3
3 3 3
4 5 6
5 5 5
YES
YES
YES
</p>