题解
2025-05-12 12:26:16
发布于:浙江
0阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int main(){
long long a,b,c,e,d,k;
cin>>a;
for(int o=1;o<=a;o++){
cin>>b>>c;
e=b*c;
if(b!=1&&c!=1){
cout<<"NO"<<endl;
continue;
}
d=0;
k=0;
for(int i=2;i<=sqrt(e);i++){
if(e%i==0){
cout<<"NO"<<endl;
k++;
d++;
break;
}
}
if(k==0){
if(d==0&&e!=0&&e!=1){
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
}
}
return 0;
}
这里空空如也
有帮助,赞一个