#include<bits/stdc++.h>
using namespace std;
int n,m,ans;
int main(){
	cin>>n>>m;
	int cnt=0;
	for(int i=n;i<=m;i++){ //外层循环:遍历1-100的数字,用i标记 
		bool f=1; //标记f 
		for(int j=2;j<i;j++){//找出来1和i本身,i存不存在第三个因数 
			if(i%j==0){
				f=0;
				break;
			}
		}
		if(f==1){
			ans++;
		}
	}
	cout<<ans<<endl;
	for(int i=n;i<=m;i++){
		bool f=1;
		for(int j=2;j<i;j++){
			if(i%j==0){
				f=0;
				break;
			}
		}
		if(f==1){
			cout<<i<<" ";
			cnt++;
			if(cnt==10){
				cout<<endl;
				cnt=0;
			}
		}
	}
	return 0;
}

0 comments

No comments so far...

Information

ID
1404
Time
1000ms
Memory
256MiB
Difficulty
8
Tags
# Submissions
53
Accepted
9
Uploaded By