GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Wednesday, 27 April 2022

Chef and Bird farm CodeChef Solution | CodeChef Problem Solution 2022

In Chefland, each chicken has X legs and each duck has Y legs. Chef's farm can have exactly one type of bird.

Given that the birds on the farm have a total of Z legs:

  • Print CHICKEN, if the farm can have only chickens but not ducks.
  • Print DUCK, if the farm can have only ducks but not chickens.
  • Print ANY, if the farm can have either chickens or ducks.
  • Print NONE, if the farm can have neither chickens nor ducks.

Input Format

  • The first line will contain T, the number of test cases. Then the test cases follow.
  • Each test case consists of a single line of input, containing three space-separated integers X,Y,Z.

Output Format

For each test case, output in a single line the type of bird on the farm.

  • Print CHICKEN, if the farm can have only chickens but not ducks.
  • Print DUCK, if the farm can have only ducks but not chickens.
  • Print ANY, if the farm can have either chickens or ducks.
  • Print NONE, if the farm can have neither chickens nor ducks.
Solution Click Below:- 

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

Constraints

  • 1T1000
  • 1X,Y,Z1000

Sample Input 1 

3
2 3 5
2 2 2
3 4 6

Sample Output 1 

NONE
ANY
CHICKEN

Explanation

Test case 1: There are 5 legs on the farm. Each chicken has 2 legs and each duck has 3 legs. Thus, the farm can have neither chickens nor ducks.

Chef and Chapters CodeChef Solution | CodeChef Problem Solution 2022

Presents for Cheffina CodeChef Solution | CodeChef Problem Solution 2022

Chef and Bird farm CodeChef Solution | CodeChef Problem Solution 2022

Valentine Vex CodeChef Solution | CodeChef Problem Solution 2022

Buying Sweets CodeChef Solution | CodeChef Problem Solution 2022

Reduce to 1 CodeChef Solution | CodeChef Problem Solution 2022

Three Arrays CodeChef Solution | CodeChef Problem Solution 2022

Test case 2: There are 2 legs on the farm. Each chicken has 2 legs and each duck has 2 legs. Thus, the farm can have any bird among chicken and duck.

Test case 3: There are 6 legs on the farm. Each chicken has 3 legs and each duck has 4 legs. Thus, the farm can have chicken only.

Join Now for Solution:- 

No comments:

Post a Comment