3 条题解

  • 1
    @ 2025-11-1 15:16:06

    包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
      @ 2026-9-9 20:29:55
      #include<bits/stdc++.h>
      using namespace std;
      int main(){
      	long long n,m,cnt;
      	cin>>n;
      	for(long long i=1;i<=n;i++){
      		cin>>m;
      		long long a[m]={0};
      		long long c=0;
      		for(long long j=0;j<m;j++){
      			cin>>a[j];
      			c=a[j]>c?a[j]:c;
      		}
      		cnt=0;
      		for(long long j=0;j<m;j++){
      			if(c%a[j]==0){
      				cnt++;
      			}	
      		}
      		if(cnt==m){
      			cout<<"Yes"<<endl;
      		}
      		else cout<<"No"<<endl;
      	}
      
      	return 0;
      }
      
      
      • -1
        @ 2025-11-1 15:16:06
        #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
        标签
        递交数
        145
        已通过
        47
        上传者