N.cpp 436 B

12345678910111213141516171819202122
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. bool Primer(int n){
  4. if(n==2)return true;
  5. if(n<2||n%2==0)return false;
  6. for(int c=3;c*c<=n;c+=2)if(n%c==0)return false;
  7. return true;
  8. }
  9. void Gold(int n){
  10. int p=n/2;
  11. if(p%2==0)--p;
  12. for(;p>=3;p-=2){
  13. if(Primer(p)&&Primer(n-p)){
  14. cout<<p<<" "<<n-p<<endl;
  15. break;
  16. }
  17. }
  18. }
  19. int main(){
  20. int n;while(cin>>n)Gold(n);
  21. return 0;
  22. }