2 solutions

  • 1
    @ 2025-10-26 10:13:25
    #include<bits/stdc++.h>
    using namespace std;
    const int N=1e5+10;
    int a[N];
    int main()
    {
    	int T;
    	cin>>T;
    	while(T--)
    	{
    		int n;
    		cin>>n;
    		int maxv=0;
    		for(int i=1;i<=n;i++)
    		{
    			cin>>a[i];	
    			maxv=max(maxv,a[i]);
    		}	
    		int cnt=0;
    		for(int j=1;j<=n;j++)
    		{
    			if(maxv%a[j]!=0)
    			{
    				cnt++;
    			}
    		}
    		if(cnt==0) cout<<"Yes"<<endl;
    		else cout<<"No"<<endl; 
    	
    	}
    
    	return 0;
    }
    
    
    • 0
      @ 2025-11-1 11:13:41

      • 1

      Information

      ID
      2182
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      9
      Tags
      # Submissions
      12
      Accepted
      3
      Uploaded By