求hack
查看原帖
求hack
592238
Elairin176楼主2022/11/3 11:06
#include <iostream>
using namespace std;
int n,x,res[1000001];
bool a,b;
int main(void){
	cin>>n;
	a=b=true;
	for(int i=0;i<n;i++){
		cin>>x;
		res[x]++; 
	}
	for(int i=2;i<=1000000/i;i++){
		int cnt=0;
		for(int j=i;j<=1000000;j+=i){
			cnt+=res[j];
		}
		if(cnt>1){
			b=false;
		}
		if(cnt==n){
			a=false;
		}
	}
	if(b){
		cout<<"pairwise coprime";
	}else if(a){
		cout<<"setwise coprime";
	}else{
		cout<<"not coprime";
	}
	cout<<endl;
} 

样例过了,提交 WA on 8~13,不用改,给组hack数据就行

2022/11/3 11:06
加载中...