TLE求调
查看原帖
TLE求调
1017223
蒟蒻whker楼主2024/11/13 21:46
#include <iostream>
#include<algorithm> 
using namespace std;
int b;
bool check (int x){
	if(x<2)return 1;
	int k=2,m=-1;
	while(x>0){
		while(x%k==0){
		x/=k,m=max(m,k);	
		}
		k++;
	}
	return m<=b;
}
int main(){
	int n;
	cin>>n>>b;
	int ans=0;
	for(int i=1;i<=n;i++){
		if(check(i)<=b)ans++;
	}
	cout<<ans;
	return 0;
}
2024/11/13 21:46
加载中...