There are total n number of Monkeys sitting on the
branches of a huge Tree. As travelers offer Bananas
and Peanuts, the Monkeys jump down the Tree.
If every Monkey can eat k Bananas and Peanuts. If
Total m number of Bananas and p number of
Peanuts offered by Travelers, calculate how many
Monkeys remain on the Tree after some of them
jumped down to eat.
At a time, one Monkey gets down and finishes eating
and go to the other side of the road. The Monkey who
climbed down does not climb up again after eating
until the other Monkeys finish eating.
Monkey can either eat k Bananas orj Peanuts. If for
last Monkey there are less than k Bananas left on the
ground or less than ; Peanuts left on the ground, only
that Monkey can eat Bananas(<k) along with the
Peanuts(<j).
Write the code to take inputs as n, m, p, k, j and
return the number of Monkeys left on the Tree.
Where, n = Total number of Monkeys
k= Number of eatable Bananas by a single Monkey
(Monkey that jumped down last may get less thank
Bananas)
j = Number of eatable Peanuts by a single Monkey
(Monkey that jumped down last may get less thank
Bananas)
m= Total number of Bananas
Answers
Answered by
0
Answer:
issyguzddhssgjsjxldjzkdkfhkjzjznznGnxjahvzjxgkjjzkchkchkfkwydjshsxgkdhccxgzhn
Similar questions