Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
46094 | liusiyu | 判断一个数是否为质数 | C++ | Accepted | 0 MS | 236 KB | 225 | 2024-04-24 21:03:46 |
#include<bits/stdc++.h> using namespace std; bool pd(int x){ for(int i=2;i*i<=x;i++){ if(x%i==0) return 0; } return 1; } int main() { int n; cin>>n; if(pd(n)) cout<<"yes"; else cout<<"no"; return 0; }