社区讨论
40分求调
B2137判决素数个数参与者 3已保存回复 3
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 3 条
- 当前快照
- 1 份
- 快照标识符
- @mli49w3w
- 此快照首次捕获于
- 2026/02/11 22:20 上周
- 此快照最后确认于
- 2026/02/11 23:55 上周
CPP
#include <bits/stdc++.h>
using namespace std;
bool isp(int x){
if(x==1) return false;
for(int j=2;j*j<=x;j++){
if(x%j==0) return false;
}
return true;
}
int main(){
int x,y,cnt=0;
cin>>x>>y;
for(int i=x;i<=y;i++){
if(isp(i)) cnt++;
}
cout<<cnt;
return 0;
}
回复
共 3 条回复,欢迎继续交流。
正在加载回复...