Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
149469 赖泓宇 14判断素数III C++ Accepted 0 MS 268 KB 467 2026-03-13 18:36:53

Tests(10/10):


Code:

#include <iostream> #include <cmath> using namespace std; int main() { int n; cin >> n; if (n < 2) { cout << "NO" << endl; return 0; } bool is_prime = true; for (int i = 2; i <= sqrt(n); i++) { if (n % i == 0) { is_prime = false; break; } } if (is_prime) { cout << "YES" << endl; } else { cout << "NO" << endl; } return 0; }