65分求助
查看原帖
65分求助
1363594
huyunxi楼主2024/11/10 15:56
#include <bits/stdc++.h>
using namespace std;

bool ans[11];

int main()
{
    int t;
    cin >> t;
    for(int i=1; i<=t; i++)
    {
        ans[i] = true;
        int n;
        cin >> n;
        int a[100001] = {};
        for(int j=1; j<=n ;j++)
        {
            cin >> a[j];
        }
        sort(a,a+n);
        for(int j=1; j<=n ;j++)
        {
            if(a[n] % a[j] != 0)
            {
                ans[i] = false;
                break;
            }
        }
    }
    for(int i=1; i<=t; i++)
    {
        if(ans[i])
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
    return 0;
}
2024/11/10 15:56
加载中...