没AC
查看原帖
没AC
1055804
zhsb楼主2024/1/7 08:41

我的为什么不过啊??

#include <bits/stdc++.h>
using namespace std;
bool zhi(int a){
	for(int i=2;i<a;i++)
		if(a%i==0)return false;//不是质数 
	return true;//是质数
}
int main(){
	int n,f1,f2,f3;
	cin>>n;
	if(zhi(n-4)==true){
		cout<<2<<' '<<2<<' '<<n-4;
		return 0;
	}
	for(int i=3;i<=n;i++){
		for(int j=3;j<=n;j++){
			for(int l=n-6;l<=n;l++){
				if(zhi(i)==true&&zhi(j)==true&&zhi(l)==true){
					cout<<i<<' '<<j<<' '<<l;
					return 0;
				} 
			}
		}
	}
    return 0;
}
```
2024/1/7 08:41
加载中...