hdu1262
/**/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>
typedef long long LL;
using namespace std;
int prime[10005], vis[10005];
void init(){
for (int i = 2; i <= 10000; i++){
if(!vis[i]){
prime[++prime[0]] = i;
}
for (int j = 1; j <= prime[0] && i * prime[j] <= 10000; j++){
vis[i * prime[j]] = 1;
if(i % prime[j] == 0) break;
}
}
}
int main()
{
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
init();
int n;
while(scanf("%d", &n) == 1){
int mid = (n >> 1);
for (int i = mid; i >= 2; i--){
if(!vis[i] && !vis[n - i]){
printf("%d %d\n", i, n - i);
break;
}
}
}
return 0;
}
/**/
虽然数据很小,但是我还是用了线筛,当做模板吧!