Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Algebraic formula first solution in Clear category for Divide Gold by kkkkk
def captain_share(gold: int, sailors: int) -> int:
"""Return the captain's share of the distributed gold.
The formula for the gold distribution is:
gold_allotment * sailors + (gold_allotment * 2) = gold
where the captain gets two times the amount of gold that is
alloted to sailors. The formula can be distilled to:
gold_allotment = gold / (sailors + 2)
"""
return 2 * (gold / (sailors + 2))
May 20, 2024
Comments: