2 条题解
-
0
包AC
#include<bits/stdc++.h> using namespace std; int n,m,a[100010],f=0; int main(){ cin >> n; for(int i=0; i<n; i++){ f=0; cin >> m; for(int j=0; j<m; j++){ cin >> a[j]; } sort(a,a+m); int x=a[m-1]; for(int j=0; j<m; j++){ if(x%a[j]!=0) { cout << "No\n"; f=1; break; } } if(f==0) cout << "Yes\n"; } return 0; } -
0
#include<bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; vector<int> a(n); int q_b = 0; for (int i = 0; i < n; ++i) { cin >> a[i]; q_b = max(q_b, a[i]); } bool b_q = true; for (int i = 0; i < n; ++i) { if (q_b % a[i] != 0) { b_q = false; break; } } if (b_q) { cout << "Yes" << endl; } else { cout << "No" << endl; } } return 0; }
- 1
信息
- ID
- 3346
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 6
- 标签
- 递交数
- 64
- 已通过
- 19
- 上传者