全re 求助 QAQ
查看原帖
全re 求助 QAQ
1345924
Constantine____楼主2024/9/5 19:31
#include<bits/stdc++.h>
using namespace std;
int a,x[1005];

bool f(int a,int b)
{
	if(a%b==0) return 1;
	else return 0;

}
int main()
{
	int n;
	cin>>a;
	for(int i=1 ; i<=a ; i++)
	{
		cin>>n;
		for(int j=1 ; j<=n ; j++)
		{
			cin>>x[j];
		}
		int max=-1;
		for(int q=1 ; q<=n ; q++)
		{
			if(x[q]>max) max=x[q];
		}
		bool y=true;

		for(int c=1 ; c<=n ; c++)
		{
			if(!f(max,x[c])) 
			{
				y=false;
				break;
			}
		}
		if(y) cout<<"Yes";
		else cout<<"No";
	}
	return 0;
}

样例没问题,自己试的也没问题 就是re!求助!!!QAQ

2024/9/5 19:31
加载中...