4 solutions
-
-2
-
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; bool st=true; //默认为真 if(n<2) //小于2的一定不是质数 { st=false; } for(int i=2;i<=sqrt(n);i++) //枚举小因子 { if(n%i==0) //存在因子 { st=false; } } if(st) //符合要求 { cout<<"yes"; } else { cout<<"no"; } return 0; }
-
1
质数
信息
ID32时间1000ms内存256MiB难度7标签(无)递交数106已通过23上传者
jike1994
状态
开发
支持
-
Information
- ID
- 32
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 1
- Tags
- (None)
- # Submissions
- 279
- Accepted
- 59
- Uploaded By