#K40257. Seat All Customers
Seat All Customers
Seat All Customers
In a restaurant, each table can seat exactly 4 people. However, the restaurant has a special seating policy. A group of customers with a size N can be fully seated if one of the following conditions holds:
- N mod 4 = 0 (the group exactly fills one or more tables), or
- 2 ≤ N mod 4 ≤ 3 (the leftover customers are either 2 or 3, which can be seated together).
If N mod 4 equals 1, then the group cannot be fully seated according to the policy.
You are given an integer T representing the number of customer groups, followed by T integers where each integer represents the number of customers in a group. For each group, output "YES" if they can all be seated following the seating policy, or "NO" otherwise.
Note: All formulas are presented in LaTeX format below:
\(N \mod 4 = 0\) or \(2 \leq N \mod 4 \leq 3\) \(\Rightarrow\) "YES"; otherwise, "NO".
inputFormat
The first line contains an integer T, the number of customer groups.
The second line contains T space-separated integers, each representing the number of customers in a group.
Input is provided via stdin
.
outputFormat
For each customer group, output a single line containing "YES" if the group can be fully seated according to the seating policy, and "NO" otherwise.
Output should be written to stdout
.
3
15 16 17
YES
YES
NO
</p>