Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
126699 | 罗嘉为 | 判断质数 | C++ | 通过 | 100 | 0 MS | 252 KB | 315 | 2024-01-24 16:56:55 |
#include <bits/stdc++.h> using namespace std; bool is(int x){ if(x < 2){ return false; } for(int i = 2; i * i <= x; i++){ if(x % i == 0){ return false; } } return true; } int main(){; int x; cin >> x; if(is(x)){ cout << "Yes"; } else { cout << "No"; } return 0; }