CF1647D Madoka and the Best School in Russia
题目描述
- 如果 $n$ 是 $d$ 的倍数,则称 $n$ 为“好数”;
- 如果 $n$ 是“好数”且不能写成任意两个“好数”之积,则称 $n$ 是“美丽数”。
$T$ 组询问,每组询问给定两个正整数 $x,d$,保证 $x$ 是好数,问 $x$ 是否有至少两种方式写为至少一个“美丽数”之积。如果是,输出 `YES`;否则输出 `NO`。
注意输出对大小写不敏感。
输入格式
第一行一个正整数 $T$ 表示数据组数。
对于每组数据,有两个正整数 $x,d$。
输出格式
对于每组数据,如果可以,输出 `YES`,否则输出 `NO`。
说明/提示
In the first example, $ 6 $ can be represented as $ 6 $ , $ 1 \cdot 6 $ , $ 2 \cdot 3 $ . But $ 3 $ and $ 1 $ are not a good numbers because they are not divisible by $ 2 $ , so there is only one way.
In the second example, $ 12 $ can be represented as $ 6 \cdot 2 $ , $ 12 $ , $ 3 \cdot 4 $ , or $ 3 \cdot 2 \cdot 2 $ . The first option is suitable. The second is— no, because $ 12 $ is not beautiful number ( $ 12 = 6 \cdot 2 $ ). The third and fourth are also not suitable, because $ 3 $ is not good number.
In the third example, $ 36 $ can be represented as $ 18 \cdot 2 $ and $ 6 \cdot 6 $ . Therefore it can be decomposed in at least two ways.