[Solution] Playing with GCD Codeforces Solution
You are given an integer array of length .
Does there exist an array consisting of positive integers such that for all ()?
Note that denotes the greatest common divisor (GCD) of integers and .
Each test contains multiple test cases. The first line contains the number of test cases (). Description of the test cases follows.
The first line of each test case contains an integer () — the length of the array .
The second line of each test case contains space-separated integers representing the array ().
It is guaranteed that the sum of over all test cases does not exceed .
For each test case, output "YES" if such exists, otherwise output "NO". You can print each letter in any case (upper or lower).
In the first test case, we can take .
In the second test case, one possibility for is .
In the third test case, it can be proved that there does not exist any array that fulfills all the conditions.
No comments:
Post a Comment