Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
126730 | 梁乃元 | 判断质数 | C++ | 通过 | 100 | 0 MS | 236 KB | 442 | 2024-01-24 17:00:47 |
# include <iostream> using namespace std ; bool isp ( long long x ) { if ( x < 2 ) { return false ; } if ( x == 2 ) { return true ; } for ( long long i = 2 ; i * i <= x ; i ++ ) { if ( x % i == 0 ) { return false ; } } return true ; } int main ( ) { long long n ; cin >> n ; if ( isp ( n ) ) { cout << "Yes" << endl ; } else { cout << "No" << endl ; } return 0 ; }