[Solution] Candy Division Solution Codechef

Candy Division Solution Codechef

There are three friends and a total of  candies.
There will be a fight amongst the friends if all of them do not get the same number of candies.

Chef wants to divide all the candies such that there is no fight. Find whether such distribution is possible.

Input Format Candy Division Solution Codechef

  • The first line of input will contain a single integer , denoting the number of test cases.
  • Each test case consists of a single integer  – the number of candies.

Output Format Candy Division Solution Codechef

For each test case, output YES, if we can distribute all the candies between the three friends equally. Otherwise output NO.

You can output each character of the answer in uppercase or lowercase. For example, the strings yEsyesYes, and YES are considered the same.

Constraints Candy Division Solution Codechef

  • 1≤�≤100
  • 1≤�≤100

Sample 1: Candy Division Solution Codechef

Input

Output

4
3
4
2
6

 

YES
NO
NO
YES

 

Explanation: Candy Division Solution Codechef

Test case 1: Chef can distribute all 3 candies such that each friend gets 1 candy. Since all three friends have same number of candies, there is no fight.

Test case 2: There exist no way of distributing all candies such that all three friends have same number of candies.

Test case 3: There exist no way of distributing all candies such that all three friends have same number of candies.

Test case 4: Chef can distribute all 6 candies such that each friend gets 2 candies. Since all three friends have same number of candies, there is no fight.

Leave a Comment