- paste
判断质数
- 2022-9-21 13:45:43 @
#include #include<math.h> using namespace std; bool f(int n){ if(n0||n1)return false; for(int i=2;i<=sqrt(n);i++){ if(n%i==0)return false; } return true; } int main(){ int t,n; cin>>t; while(t--){ cin>>n; if(f(n))cout<<"Yes"<<endl; else cout<<"No"<<endl; }
return 0;
}
0 comments
No comments so far...