Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
4698 | 邓小龙 | 13判断质数 | C++ | Accepted | 0 MS | 264 KB | 300 | 2024-09-07 15:40:11 |
# include<iostream> using namespace std; int main(){ int n; cin>>n; //遍历2至n-1,看是否有能整除的数,如果有,则结束,此数为合数 for(int i=2;i<=n-1;i++){ if(n%i==0) {cout<<"No"<<endl;return 0;} } cout<<"Yes"<<endl; return 0; }