3076: 【普及-】【P2651】添加括号III

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:1 解决:1

题目描述

现在给出一个表达式,形如 lns="http://www.w3.org/1998/Math/MathML">�1/�2/�3/.../��。

如果直接计算,就是一个个除过去,比如 lns="http://www.w3.org/1998/Math/MathML">1/2/1/4=1/8。

然而小lns="http://www.w3.org/1998/Math/MathML">A看到一个分数感觉很不舒服,希望通过添加一些括号使其变成一个整数。一种可行的办法是 lns="http://www.w3.org/1998/Math/MathML">(1/2)/(1/4)=2 。

现在给出这个表达式,求问是否可以通过添加一些括号改变运算顺序使其成为一个整数。

说明/提示

  • 对于 lns="http://www.w3.org/1998/Math/MathML">40% 的数据,lns="http://www.w3.org/1998/Math/MathML">�≤16。
  • 对于 lns="http://www.w3.org/1998/Math/MathML">70% 的数据,lns="http://www.w3.org/1998/Math/MathML">�≤100。
  • 对于 lns="http://www.w3.org/1998/Math/MathML">100% 的数据, lns="http://www.w3.org/1998/Math/MathML">2≤�≤10000,lns="http://www.w3.org/1998/Math/MathML">1≤�≤100,lns="http://www.w3.org/1998/Math/MathML">1≤��≤231−1。

输入

一个测试点中会有多个表达式。

第一行 lns="http://www.w3.org/1998/Math/MathML">� ,表示表达式数量。

对于每个表达式,第一行是 lns="http://www.w3.org/1998/Math/MathML">�,第二行 lns="http://www.w3.org/1998/Math/MathML">� 个数,第 lns="http://www.w3.org/1998/Math/MathML">� 个数表示 lns="http://www.w3.org/1998/Math/MathML">��。

输出

输出 lns="http://www.w3.org/1998/Math/MathML">� 行。

对于每个表达式,如果可以通过添加括号改变顺序使其变成整数,那么输出 Yes,否则输出 No。

样例输入 复制

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

样例输出 复制

Yes
No