#P8807. [蓝桥杯 2022 国 C] 取模

    ID: 9723 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 难度: 5 上传者: 标签>2022数论枚举鸽笼原理蓝桥杯国赛

[蓝桥杯 2022 国 C] 取模

Problem Description

Given n,mn, m, determine whether there exist two different numbers x,yx, y such that 1x<ym1 \le x < y \le m and nmodx=nmodyn \bmod x = n \bmod y.

Input Format

The input contains multiple independent queries.

The first line contains an integer TT, representing the number of queries.

The next TT lines each contain two integers n,mn, m, separated by a space, representing one query.

Output Format

Output TT lines. Each line corresponds to the result of one query. If such x,yx, y exist, output the word Yes; otherwise, output the word No.

3
1 2
5 2
999 99
No
No
Yes

Hint

For 20%20\% of the test cases, T100T \le 100, n,m1000n, m \le 1000.

For 50%50\% of the test cases, T10000T \le 10000, n,m105n, m \le 10^5.

For all test cases, 1T1051 \le T \le 10^5, 1n1091 \le n \le 10^9, 2m1092 \le m \le 10^9.

Lanqiao Cup 2022 National Contest, Group C, Problem C.

Translated by ChatGPT 5