求助,C++样例过了,洛谷0分
查看原帖
求助,C++样例过了,洛谷0分
1264100
Galactictrajectory楼主2024/8/29 17:06

我的代码:

#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 x = 0;
		for(int i = 1;i <= n;i++){
			cin >> a[i];
			x = max(x,a[i]);
		}
		int f1 = 0;
		for(int i = 1;i <= n;i++){
			if(x % a[i]) f1 = 1;
		}
		if(f1) cout << "NO";
		else cout << "YES";
	}
	return 0;
}
2024/8/29 17:06
加载中...