社区讨论
3w7t求调必关
B3969[GESP202403 五级] B-smooth 数参与者 2已保存回复 2
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 2 条
- 当前快照
- 1 份
- 快照标识符
- @mjlhdn7t
- 此快照首次捕获于
- 2025/12/25 21:30 2 个月前
- 此快照最后确认于
- 2025/12/27 18:40 2 个月前
#include<bits/stdc++.h>
using namespace std;
bool zhishu(long long a){
if(a==1) return false;
else if(a==2)return true;
else{
for(long long i=2;i<=sqrt(a);i++){
if(a%i==0) return false;
}
}
return true;
}
long long n,m,ans=0;
int main(){
cin>>n>>m;
for(long long i=1;i<=n;i++){
long long maxn=0;
for(long long j=1;j*j<=n;j++){
if(!zhishu(i)) continue;
if(i%j==0) maxn=max(maxn,j);
}
if(maxn<=m) ans+=1;
}
cout<<ans;
return 0;
}
回复
共 2 条回复,欢迎继续交流。
正在加载回复...