hhhhhhhhhhh
2024-07-12 13:14:15
发布于:广东
3阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if (n <= 1) {
cout << "No";
return 0;
}
if (n == 2 || n == 3) {
cout << "Yes";
return 0;
}
if (n % 2 == 0 || n % 3 == 0) {
cout << "No";
return 0;
}
int sqrt_n = sqrt(n);
for (int i = 5; i * i <= n; i += 6) {
if (n % i == 0 || n % (i + 2) == 0) {
cout << "No";
return 0;
}
}
cout << "Yes";
return 0;
}
这里空空如也
有帮助,赞一个