12345678910111213141516171819202122 |
- #include<bits/stdc++.h>
- using namespace std;
- bool Primer(int n){
- if(n==2)return true;
- if(n<2||n%2==0)return false;
- for(int c=3;c*c<=n;c+=2)if(n%c==0)return false;
- return true;
- }
- void Gold(int n){
- int p=n/2;
- if(p%2==0)--p;
- for(;p>=3;p-=2){
- if(Primer(p)&&Primer(n-p)){
- cout<<p<<" "<<n-p<<endl;
- break;
- }
- }
- }
- int main(){
- int n;while(cin>>n)Gold(n);
- return 0;
- }
|