740 人解决,855 人已尝试。
1087 份提交通过,共有 2446 份提交。
1.1 EMB 奖励。
单点时限: 2.0 sec
内存限制: 256 MB
We arrange the numbers between 1 and N (1 <= N <= 10000) in increasing order and decreasing order like this:
1 2 3 4 5 6 7 8 9 . . . N
N . . . 9 8 7 6 5 4 3 2 1
Two numbers faced each other form a pair. Your task is to compute the number of pairs P such that both numbers in the pairs are prime.
The first line of input gives the number of cases, C (1 ≤ C ≤ 100). C test cases follow.
Each test case consists of an integer N in one line.
For each test case, output P .
4 1 4 7 51
0 2 2 6
740 人解决,855 人已尝试。
1087 份提交通过,共有 2446 份提交。
1.1 EMB 奖励。