7321: Pretty Average Primes(Problem S2)

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:0 解决:0

题目描述

For various given positive integers N > 3, find two primes, A and B such that N is the average (mean) of A and B. That is, N should be equal to (A + B)/2. 
Recall that a prime number is an integer P > 1 which is only divisible by 1 and P. For example, 2, 3, 5, 7, 11 are the first few primes, and 4, 6, 8, 9 are not prime numbers.

输入

The first line of input is the number T (1 ≤ T ≤ 1000), which is the number of test cases. 
Each of the next T lines contain one integer Ni (4 ≤ Ni ≤ 1 000 000, 1 ≤ i ≤ T). 
For 6 of the available 15 marks, all Ni < 1 000.

输出

The output will consist of T lines. The ith line of output will contain two integers, Ai and Bi , separated by one space. It should be the case that Ni = (Ai + Bi)/2 and that Ai and Bi are prime numbers. 
If there are more than one possible Ai and Bi for a particular Ni , output any such pair. The order of the pair Ai and Bi does not matter. 
It will be the case that there will always be at least one set of values Ai and Bi for any given Ni

样例输入 复制

4
8
4
7
21

样例输出 复制

3 13
5 3
7 7
13 29

提示