zclzslz @ 2016-05-05 20:49:40
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<iostream>
using namespace std;
int n,ans1,ans2,ans3;
bool p(0);
bool pd(int i)//判断素数
{
int x=2;
while(x<=floor(sqrt(i))&&i%x!=0)
x++;
if(x>sqrt(i))
return 1;
return 0;
}
int main()
{
scanf("%d",&n);
for(int i=2;i<=n;i++)
{
if(pd(i)==1&&pd(n-2-i)==1)
{
ans1=2;
ans2=i;ans3=n-2-i;
p=1;
break;
}
}
if(p==0)
{
for(int i=3;i<=n;i+=2)
{
for(int j=3;j<=n;j+=2)
{
if(pd(i)==1&&pd(j)==1&&pd(n-i-j)==1)
{
p=1;
ans1=i;ans2=j;ans3=n-i-j;
break;
}
}
if(p==1)
break;
}
}
printf("%d %d %d\n",ans1,ans2,ans3);
return 0;
}