# BIRDFARM Editorial

Setter: Kanhaiya Mohan
Tester: Felipe Mota, Aryan
Editorialist: Pratiyush Mishra

591

None

# PROBLEM:

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.

# EXPLANATION:

Given that each chicken has X legs and each duck has Y legs, we are given the total number of legs as Z. Now there can be four cases here:

• For the farm to only have Chickens.
Z \;mod \; X = 0 \; and \; Z \;mod\; Y \neq 0
• For the farm to only have Ducks.
Z \;mod \; X \neq 0 \; and \; Z \;mod\; Y = 0
• For the farm to have Any.
Z \;mod \; X = 0 \; and \; Z \;mod\; Y = 0
• For the farm to have None.
Z \;mod \; X \neq 0 \; and \; Z \;mod\; Y \neq 0

# TIME COMPLEXITY:

O(1) for each test case.