UKE自动机 @ 2017-11-12 10:11:17
#include<cstdio>
#include<iostream>
using namespace std;
int main(){
int zhishu[30000]={},n;
for(int i=2;i<=20005;i++){
for(int j=2;j<i;j++){
if(i%j==0)zhishu[i]=1;
}
}
cin>>n;
for(int i=2;i<=20005;i++){
if(zhishu[i]==0){
for(int j=2;j>=i;j++){
if(zhishu[j]==0){
for(int z=2;z>=j;z++)
if(zhishu[z]==0&&i+j+z==n){cout<<i<<" "<<j<<" "<<z;break;}
}
}
}
}
return 0;
}
by Lolierl @ 2017-11-12 10:18:00
int zhishu[30000]={0}