题解 | #素数判定#
素数判定
https://www.nowcoder.com/practice/5fd9c28b1ce746dd99287a04d8fa9002
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
int x;
cin >> x;
if(x < 2) cout << "no" << endl;
else {
for(int i = 2 ; i<=sqrt(x);i++){
if(x % i == 0) {
cout << "no" << endl;
return 0;
}
}
cout << "yes" << endl;
}
}