Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Divide Gold: Rates Are Rising by juestr
def winner_share(gold: int, sailors: int) -> int:
if not sailors:
return gold
else:
share1, odd1 = divmod(gold, sailors + 2)
share2, odd2 = divmod(gold, sailors)
if not odd1:
return share1 * 2
elif not odd2:
return share2
else:
for d in range(sailors + 1, 2, -1):
share3, odd3 = divmod(gold, d)
if not odd3:
return share3 * 2
else:
return gold
May 20, 2024
Comments: