满江红 玄关求调QwQ
查看原帖
满江红 玄关求调QwQ
1126200
noWAnoWA楼主2024/8/29 22:52

样例过了

#include<bits/stdc++.h>
using namespace std;
long long n,top;
bool isPrime(int i){
	if(i<2) return 0; 
	for(int j=2;j<=sqrt(i);j++) if(i%j==0) return 0;
	return 1;
}
int main(){
	int t;
	cin>>t;
	while(t--){
		cin>>n;
		if(isPrime(n)){
			cout<<0<<endl;
			continue;
		}
		for(int i=2;i<=sqrt(n);i++){
			if(n%i==0){
				for(int j=1;;j++){
					if(n%i==0) n/=i;
					else break;
				}
				++top;
			}
		}
		if(n>1) ++top;
		if(top==2) cout<<1<<endl;
		else cout<<0<<endl;
	}
	return 0;
}
2024/8/29 22:52
加载中...