求助
查看原帖
求助
1246444
tangmingge楼主2024/5/4 21:05
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,b,ans=0;
	cin>>n>>b;
	for(int i=n;i>=1;i--){
		for(int j=i;j>=2;j--){
			if(i%j==0){
				int ts=0;
				for(int k=2;k<j;k++){
					if(j%k==0){
						ts=1;
					}
				}
				if(ts==0){
					if(j<=b){
						ans++;	cout<<j<<" ";
					}
				
					break;
				}
			}
		}
	}
	cout<<ans;
	return 0;
} 
2024/5/4 21:05
加载中...