救命!!!为什么不对???求大佬看看
查看原帖
救命!!!为什么不对???求大佬看看
617131
Lxt112234楼主2022/3/13 19:30

求大佬看看哪里不对(我已经要疯了QAQ)。 谢谢谢谢谢谢谢谢谢谢!!!!!!!!!!!!

#include<iostream> 

int pdzs(int a){
	for(int m=2;m<=a-1;m++){
		if(a%m==0){
			return 0;
		}
		
	}
	return 1;
}
using namespace std;
int main(){

	int x,y,n,j,u=4;
	cin>>n; 

	for(int b=4;b<=n;b+=2) {
		for(int j=1;;j++){
		    x=2;
		    int s=pdzs(x);
			if(s==1){
				y=b-x;
				int m=pdzs(y);
				if(m==1){
					cout<<b<<"="<<x<<"+"<<y<<endl;
					break;
			
				}else{
					x=x+1;
				}
				}else{
				x=x+1;
		}

}
}
	return 0;

}
2022/3/13 19:30
加载中...