小白白白白 @ 2018-12-14 14:25:49
using namespace std;
int prime[200011],prime1[200011],n,zz=0,minn1=20001,minn2=20001,minn3=20001;
bool isprime(int n1)
{
for(int j=2;j<=sqrt(n1);j++) if(n1%j==0) return false;
prime1[n1]=1;
return true;
}
int main()
{
cin>>n;
for(int i=3;i<=20000;i+=2) if(isprime(i)) prime[++zz]=i;
for(int i=1;i<=zz;i++)
for(int j=1;j<=zz;j++)
{
int k=n-prime[i]-prime[j];
if(prime1[k])
{
if(prime[i]<minn1) minn1=prime[i],minn2=prime[j],minn3=k;
else if(prime[i]==minn1&&prime[j]<minn2) minn1=prime[i],minn2=prime[j],minn3=k;
}
}
cout<<minn1<<' '<<minn2<<' '<<minn3<<endl;
return 0;
}
by Spikeweed @ 2018-12-14 14:51:37
emmmm