Balls and Boxes Codechef Solution

We Are Discuss About CODECHEF SOLUTION

Balls and Boxes Codechef Solution

Balls and Boxes Codechef Solution

Answers will be Uploaded Shortly and it will be Notified on Telegram, So JOIN NOW
JoinScishowEngineerTelegram

Problem

You have N balls and K boxes. You want to divide the N balls into K boxes such that:

  • Each box contains \ge 1 balls.
  • No two boxes contain the same number of balls.

Determine if it is possible to do so.

Input Format

  • The first line contains a single integer T — the number of test cases. Then the test cases follow.
  • The first and only line of each test case contains two space-separated integers N and K — the number of balls and the number of boxes respectively.

Output Format

For each test case, output YES if it is possible to divide the N balls into K boxes such that the conditions are satisfied. Otherwise, output NO.

You may print each character of YES and NO in uppercase or lowercase (for example, yesyEsYes will be considered identical).

Constraints

  • 1 \leq T \leq 10^5
  • 1 \le N \le 10^9
  • 1 \le K \le 10^4

Sample 1:

Input

Output

4
3 4
30 3
2 2
1 1
NO
YES
NO
YES

Explanation:

Test Case 1: It is not possible to divide the 3 balls into 4 boxes such that each box contains \ge 1 balls.

Test Case 2: One way to divide the 30 balls into 3 boxes is the following: [5, 9, 16].

Test Case 3: It is not possible to divide the 2 balls into 2 boxes such that no two boxes contain the same number of balls.

Test Case 4: We can divide 1 ball into 1 box.

Answers will be Uploaded Shortly and it will be Notified on Telegram, So JOIN NOW
JoinScishowEngineerTelegram

 

SOLUTION

Balls and Boxes Codechef Solution

Yhaa You have done it but next? if YOU Want to Get Others Please Visit Here JOIN NOW

Answers will be Uploaded Shortly and it will be Notified on Telegram, So JOIN NOW
JoinScishowEngineerTelegram

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *