U161288 【模板】Miller-Rabin
题目背景
Miller-Rabin 素性检验模板题。
题目描述
本题有多组数据。
对于每组数据,输入一个数 $a$,判断它是不是质数。
输入格式
第 $1$ 行,数据组数 $t$。
接下来 $t$ 行,每行一个整数 $a$。
输出格式
输出共 $t$ 行。
若 $a$ 为质数,输出 `YES`,否则输出 `NO`。
说明/提示
对于 $50\%$ 的数据,$1 \le t \le 10$,$1 \le a_i \le 10^{2}$。
对于 $100\%$ 的数据,$1 \le t \le 30$,$1 \le a_i \le 9 \times 10^{18}$。
单个数据点时间限制为 $\texttt{50ms}$。
建议使用 $\texttt{Miller-Rabin}$ 算法来通过此题。