CodechefJun 03, 2025

Jenga Night

Hazrat Ali

Codechef

There are XX Jenga tiles available. In one round, all the players pick 11 tile each and place it in the tower.
The game is valid if:

  • All the players have a tile in each round;
  • All the tiles are used at the end.

Given NN and XX, find whether the game is valid.

Input Format

  • First line will contain TT, the number of test cases. Then the test cases follow.
  • Each test case contains a single line of input, containing two space-separated integers NN and XX representing the number of people at the party and the number of available tiles respectively.

Output Format

For each test case, output in a single line YESYES if the game is valid, else output NONO.

You may print each character of the string in uppercase or lowercase (for example, the strings YeSYeSyEsyEsyesyes and YESYES will all be treated as identical).

Constraints

  • 1≤T≤104
  • 1≤N,X≤1000

Sample 1:

Input
3
3 3
4 2
2 4
Output
 
YES
NO
YES

Solution
m = int(input())
while m != 0:
    N, X = map(int, input().split())
    if X % N == 0:
        print("YES")
    else:
        print("NO")
    m -= 1





Comments