Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
93621 | 张新福 | 判断素数 | C++ | Accepted | 1 MS | 268 KB | 326 | 2024-10-18 18:14:17 |
#include <bits/stdc++.h> using namespace std; bool sushu(int n){ bool r=true; int i; for(i=2;i<=sqrt(n);i++){ if(n%i==0){ r=false; break; } } if(n<=1){ r=false; } return r; } int main(){ int a; cin>>a; if(sushu(a)==true){ cout<<"Yes"<<endl; }else{ cout<<"No"<<endl; } }