#P2651. 添加括号III

    ID: 1676 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 难度: 3 上传者: 标签>数学高精度最大公约数,gcd进制

添加括号III

Description

You are given an expression of the form a1/a2/a3/.../ana_{1}/a_{2}/a_{3}/.../a_{n}.

If you evaluate it directly from left to right, for example, 1/2/1/4=1/81/2/1/4 = 1/8.

However, Little A feels uncomfortable seeing a fraction and wants to insert some parentheses to make it an integer. One possible way is (1/2)/(1/4)=2(1/2)/(1/4)=2.

Given the expression, determine whether it is possible to change the evaluation order by adding parentheses so that the result becomes an integer.

Input Format

There are multiple expressions in one test file.

The first line contains tt, the number of expressions.

For each expression, the first line contains nn, and the second line contains nn numbers. The ii-th number denotes aia_{i}.

Output Format

Output tt lines.

For each expression, if it is possible to change the evaluation order by adding parentheses to make the result an integer, output Yes; otherwise, output No.

2
4
1 2 1 4
5
6 5 7 9 12
Yes
No

Hint

  • For 40%40\% of the testdata, n16n \le 16.
  • For 70%70\% of the testdata, n100n \le 100.
  • For 100%100\% of the testdata, 2n100002 \le n \le 10000, 1t1001 \le t \le 100, 1ai23111 \le a_{i}\le 2^{31}-1.

Translated by ChatGPT 5