Published September 07, 2022 by

Balls and Boxes Codechef Solution Java (BALLBOX)

Problem

  • You have NN balls and KK boxes. You want to divide the NN balls into KK boxes such that:
  • Each box contains  ≥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 TT — the number of test cases. Then the test cases follow.
  • The first and only line of each test case contains two space-separated integers NN and KK — 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 NN balls into KK 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, yes, yEs, Yes will be considered identical).

Constraints

  • 1 \le N \le 10^9
  • 1 \le K \le 10^4