lili_flyingcutter @ 2017-04-26 21:15:58
#include<cstdio>
using namespace std;
bool ff(int a,int i){if(i*i>a)return 1;
if(a==2)return 1;if(a%i==0)return 0;else return ff(a,i+1);
}
int main(){
int n,i=2;scanf("%d",&n);printf("%d ",3);n-=3;
while(i<=n){if(ff(i,2)&&ff(n-i,2))break;i++;}
printf("%d %d",i,n-i);
}
by zhousirui070502 @ 2017-06-27 15:08:42
#include<bits/stdc++.h>
using namespace std;
bool s(int i)
{
int x=2;
while(x<=floor(sqrt(i))&&i%x!=0)
x++;
if(x>sqrt(i))
return 1;
return 0;
}
int main()
{
int n;
cin>>n;
for(int i=2;i<=n-4;i++)
if(s(i))
for(int j=i;i+j<=n-2;j++)
if(s(j))
if(s(n-j-i))
{
cout<<i<<" "<<j<<" "<<n-j-i<<endl;
return 0;
}
return 0;
}
by zhousirui070502 @ 2017-06-27 15:09:25
ac ac ac ac ac ac ac ac ac ac ac ac