The One Where It All Began solution codechef

The One Where It All Began solution codechef

In a New York City coffee house called Central Perk, we’re introduced to six friends: chef Monica Geller, data controller Chandler Bing who lives across the hall from Monica, Chandler’s roommate/actor Joey Tribbiani, Monica’s brother Ross Geller, new ageist Phoebe Buffay, and “born to be a wife” Rachel Green.

Chef wants to divide NN cookies between the six friends such that:

  • Each friend gets at least one cookie.
  • No two friends get the same number of cookies.

Find if it is possible for Chef to do so.

Input Format The One Where It All Began solution codechef

  • First line will contain TT, number of testcases. Then the testcases follow.
  • Each testcase contains of a single line of input, one integers NN.

The One Where It All Began solution codechef Output Format

For each test case print “YES” if Chef can divide the cookies according to the given rules, else print “NO”.

You may print each character of each string in uppercase or lowercase (for example, the strings “yEs”, “yes”, “Yes” and “YES” will all be treated as identical).

Constraints

  • 1T1031≤T≤103
  • 1N1031≤N≤103

Sample Input 1 

3
42
5
909

Sample Output 1  The One Where It All Began solution codechef

YES
NO
YES

Explanation

Test case 1: One possible way of distribution would be 2,4,6,8,10,122,4,6,8,10,12.

Test case 2: It is impossible to divide 55 cookies among six friends according to given rules.

Leave a Comment

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