HBB-Editorial

PROBLEM LINK:

CONTEST

PRACTICE

Author:Hiral Saini

Tester: Akansha Bigasia

Editorialist: Hiral Saini

DIFFICULTY:

CAKEWALK

PREREQUISITES:

Ratio and Proportion

PROBLEM:

Humpy’s mom has to divide the sugarcane to all the friends, in the ratio of their ages.

QUICK EXPLANATION:

The task is to determine whether it is possible to serve sugarcane to everyone as integral multiples of their ages.

EXPLANATION:

In question BIRTHDAY BASH, our job was to find that weather the sugarcane ordered by the elephant for his birthday party can be divided among the people present at the party as a integral multiple of their ages or not.

To check this we have to find the sum of ages of all the guest came to the party (given as input) plus the age of the elephant and then the length of the sugarcane should be divided by the total age. If on division we get an integer then the output will be YES (as we get the integral multiple);otherwise NO.

EXAMPLE:

(i) for input:
4 10 2
2 2 3 1
HERE : No of guests=4
Length of sugarcane=10
Age of elephant=2
Age of guests are=2,2,3 and 1
Total age=2+2+2+3+1=10
Now, 10/10=1 which is an integer so output is YES. We can divide the sugarcane of 10 unit as 2 unit,2 unit, 3 unit, 1 unit among guests and the elephant will get 2 units. similarly,

(ii) for input:
5 12 3
6 5 7 3
HERE : No of guests=4
Length of sugarcane=12
Age of elephant=3
Age of guests are=6,5,7 and 3
Total age 6+5+7+3+3=24
Now, 12/24=0.5 which is not an integer so output is NO.

AUTHOR’S AND TESTER’S SOLUTIONS:

The solution can be found here.