#C1423. Binary Concatenation Divisibility

    ID: 43856 Type: Default 1000ms 256MiB

Binary Concatenation Divisibility

Binary Concatenation Divisibility

Given a sequence of test cases, each containing an array of integers, you are required to convert each integer into its binary representation (without any leading zeros) and then concatenate these binary representations into a single binary string. Let this concatenated binary string be denoted by (B). Your task is to determine whether (B) is divisible by 5, i.e., if (B \equiv 0 \pmod{5}). For each test case, output "Yes" if it is divisible by 5, and "No" otherwise.

inputFormat

The input begins with an integer (T) representing the number of test cases. Each test case starts with an integer (N) (the number of integers in the test case) followed by (N) space-separated integers.

outputFormat

For each test case, output a single line containing "Yes" if the concatenated binary representation of the provided numbers is divisible by 5, otherwise output "No".## sample

4
3 2 3 4
2 5 6
1 5
1 10
No

No Yes Yes

</p>