1 条题解
-
0
#include <bits/stdc++.h> #define int long long using namespace std; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int t; int n, a[10000 + 5]; signed main() { cin >> t; while (t--) { cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; int now = a[2]; // 记录分母 now /= gcd(a[1], now); for (int i = 3; i <= n; i++) now /= gcd(a[i], now); if (now == 1) cout << "Yes\n"; else cout << "No\n"; } return 0; }
- 1
信息
- ID
- 3474
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 2
- 标签
- 递交数
- 17
- 已通过
- 5
- 上传者