全TLE,回了必关
查看原帖
全TLE,回了必关
1390483
ysx668楼主2024/12/6 22:11
#include<bits/stdc++.h>
using namespace std;
int n,m,f = 1;
int a[100005];

int main()
{
	cin >> m;
	for(int i = 1;i<=m;i++)
	{
		cin >> n;
		f = 0;
		int j;
		for(j = 1;j<=n;j++)
		{	
			cin >> a[j];	
		} 
		for(int j = 1;j<=n;j++)
		{
			for(int k = 1;k<j;k++)
			{
				//cout<< a[j]<<" "<<a[k]<<endl;
				if(a[j]%a[k]== 0)
				{
					f = 1;
				}
			}
			for(int k = j+1;k<=n;k++)
			{
				//cout<< a[j]<<" "<<a[k]<<endl;
				if(a[j]%a[k]== 0)
				{
					f = 1;
				}
			}
		}
		
		if(f) cout<< "Yes"<<endl;
		else cout<<"No"<<endl;
	}
	return 0;
}
2024/12/6 22:11
加载中...