neverlove @ 2024-07-28 14:37:33
#include "iostream"
using namespace std;
bool check(int x){
for(int i=2;i*i<=x;i++){
if(x%i==0)return false;
}
return true;
}
int main(){
int a=2,b=2,c=2;
int n;
cin>>n;
while(a<n){
while(b<n){
while(c<n){
if(a+b+c==n&&check(a)&&check(b)&&check(c)){
cout<<a<<' '<<b<<' '<<c;
}
if(c%2==0)c++;
else c+=2;
}
if(b%2==0)b++;
else b+=2;
}
if(a%2==0)a++;
else a++;
}
return 0;
}
by shexiaopeng @ 2024-07-30 19:51:41
你输出后要结束,建议在17行后加上return 0;