Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
126801 | 吴悠 | 判断质数 | C++ | 通过 | 100 | 0 MS | 248 KB | 289 | 2024-01-24 17:08:23 |
#include<iostream> #include<cmath> using namespace std; bool judge(int n){ for(int i=2;i<=sqrt(n);i++){ if(n%i==0){ return false; } } return true; } int main(){ int n; cin>>n; if(judge(n)==true){ cout<<"Yes"<<endl; } else cout<<"No"<<endl; return 0; }