Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
2219 | 王彦皓 | 13判断质数 | C++ | Accepted | 0 MS | 272 KB | 273 | 2023-12-16 19:58:08 |
#include <iostream> #include <cmath> using namespace std; bool fn(int a){ for(int i=2;i<a;i++){ if(a%i==0){ return 0; } } return 1; } int main(){ int s; cin>>s; if(fn(s)){ cout<<"Yes"<<endl; } else{ cout<<"No"<<endl; } return 0; }