HELP!为什么只能输出4=2+2
查看原帖
HELP!为什么只能输出4=2+2
1063108
shensujin楼主2023/8/16 18:02
#include <iostream>
using namespace std;
int main()
{
	int N,n,j,i,l;
	int zs=0;
	cin>>N;
	for(i=1;i<=(N-2)/2;i++)
	{
		n=2*i+2;
		for(j=2;j<=n;j++)
		{
			for(l=2;l<j;l++)
			{
				if((j%l==0)or((n-j)%l==0))
					zs=1;
					
							
			}
			if(zs==0)
				cout<<n<<"="<<j<<"+"<<(n-j)<<endl;
				
				
				}		
	}
	return 0;	
 } 
2023/8/16 18:02
加载中...