#K58547. Lucky Sequence Cards

    ID: 30666 Type: Default 1000ms 256MiB

Lucky Sequence Cards

Lucky Sequence Cards

You are given an integer \(N\) representing the number of cards and an integer \(D\) representing the minimum difference between consecutive cards. Starting from an initial card value of 1, you repeatedly add \(D\) until the current sum exceeds \(N\). Let the last card value before exceeding \(N\) be \(L\). The task is to determine whether \(L\) is at least \(N\) (i.e. \(L \geq N\)). If yes, then a lucky sequence can be formed; otherwise, it cannot.

Input/Output Details:

The program will first read an integer \(T\) from standard input, which indicates the number of test cases. For each test case, two space-separated integers \(N\) and \(D\) will be provided in a new line. For each test case, output "YES" if a lucky sequence can be formed or "NO" if it cannot.

Formally, let \(current = 1\). While \(current \leq N\), update \(current = current + D\). If \(current - D \geq N\), then output "YES", else output "NO".

inputFormat

The first line of input contains a single integer \(T\), the number of test cases. Each of the following \(T\) lines contains two space-separated integers \(N\) and \(D\), where \(N\) is the number of cards and \(D\) is the minimum difference between consecutive cards.

outputFormat

For each test case, output a single line containing either "YES" if it is possible to form the lucky sequence, or "NO" otherwise.

## sample
3
5 1
5 2
5 6
YES

YES NO

</p>