No.8030 Test of the Miller-Rabin Primality Test
Problem Statement
For each of the given $n$ positive integers, determine whether it is prime.
Input
$n$
$x_{0}$
$x_{1}$
...
$x_{n-1}$
The first line contains the number of queries $n$.
The second and subsequent lines contain the $n$ positive integers to be tested for primality.
・$n$ is a positive integer.
・$1 \le n \le 10{,}000$
・$1 \le x_{i} \lt 2^{63}$ (fits in a 64-bit signed integer)
Output
For each positive integer,
output the value and whether it is prime (1 if it is prime, 0 otherwise), separated by a single-byte space, preserving the input order, followed by a newline.
Sample
Input
4 10 2 1 5
Output
10 0 2 1 1 0 5 1
Since the first line is 4, primality is tested for 4 positive integers.
10 and 1 are not prime, so output the number itself and a space, followed by 0;
2 and 5 are prime, so output 1.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。