This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#include <bits/stdc++.h>
using namespace std;
int t;
//最大公约数
int gcd(int x, int y) {
return y ? gcd(y, x % y) : x;
}
int main() {
cin >> t;
while (t--) {
int n;
cin >> n;
//一次读入第一个和第二个
int a, b;
cin >> a >> b;
b /= gcd(a, b);//去掉a,b公因子,目标是b=1,a已经发近挥不出来力量啦
//逐个读入,逐个约分
for (int i = 3; i <= n; i++) {
int x;
cin >> x;
b /= gcd(x, b);
if (b == 1) cout << "Yes" << endl;
else cout << "No" << endl;
return 0;