CF986F.Oppa Funcan Style Remastered

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Surely you have seen insane videos by South Korean rapper PSY, such as "Gangnam Style", "Gentleman" and "Daddy". You might also hear that PSY has been recording video "Oppa Funcan Style" two years ago (unfortunately we couldn't find it on the internet). We will remind you what this hit looked like (you can find original description here):

On the ground there are nn platforms, which are numbered with integers from 11 to nn , on ii -th platform there is a dancer with number ii . Further, every second all the dancers standing on the platform with number ii jump to the platform with the number f(i)f(i) . The moving rule ff is selected in advance and is not changed throughout the clip.

The duration of the clip was kk seconds and the rule ff was chosen in such a way that after kk seconds all dancers were in their initial positions (i.e. the ii -th dancer stood on the platform with the number ii ). That allowed to loop the clip and collect even more likes.

PSY knows that enhanced versions of old artworks become more and more popular every day. So he decided to release a remastered-version of his video.

In his case "enhanced version" means even more insanity, so the number of platforms can be up to 101810^{18} ! But the video director said that if some dancer stays on the same platform all the time, then the viewer will get bored and will turn off the video immediately. Therefore, for all xx from 11 to nn f(x)xf(x) \neq x must hold.

Big part of classic video's success was in that looping, so in the remastered version all dancers should return to their initial positions in the end of the clip as well.

PSY hasn't decided on the exact number of platforms and video duration yet, so he asks you to check if there is a good rule ff for different options.

输入格式

In the first line of input there is one integer tt ( 1t1041 \le t \le 10^{4} ) — the number of options for nn and kk to check.

In the next tt lines the options are given: each option is described with two integers nn and kk ( 1n10181 \le n \le 10^{18} , 1k10151 \le k \le 10^{15} ) — the number of dancers and the duration in seconds.

It is guaranteed that the number of different values of kk in one test is not greater than 5050 .

输出格式

Print tt lines. If the ii -th option of the video is feasible, print "YES" (without quotes) in ii -th line, otherwise print "NO" (without quotes).

输入输出样例

  • 输入#1

    3
    7 7
    3 8
    5 6
    

    输出#1

    YES
    NO
    YES
    
首页