爷爷们帮我看看有什么问题,再改下错
查看原帖
爷爷们帮我看看有什么问题,再改下错
654535
Zhouyuan0father楼主2022/2/27 15:03
#include <bits/stdc++.h>
using namespace std;
bool SBcyx(int y) {
    for(int i=2;i*i<=y;i++){
    	if(y%i==0){
    		return 0;
		}
	}
	return 1;
}
void cyxSB(int a,int y) {
	for(int i=2; i<=9; i++) {
		if(SBcyx(y*10+i)) {
			if(a==0){
				cout<<y<<endl;
			}
			cyxSB(a-1,y*10+i);
		}
	}
}
int main() {
	int a;
	cin>>a;
	int y=0;
	cyxSB(a,y);
	return 0;
}

2022/2/27 15:03
加载中...