Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Nothing special here, but clean solution in Clear category for The Brick Factory Problem by Selindian
def crosses(k: int, s: int = None) -> int:
# Just using formulas by "The Brick Factory Problem" Video
if s != None:
min_crosses = int(k/2) * int((k-1)/2) * int(s/2) * int((s-1)/2)
else:
min_crosses = int(1/4 * int(k/2) * int((k-1)/2) * int((k-2)/2) * int((k-3)/2))
return min_crosses
print("Example:")
print(crosses(6, 5))
# These "asserts" are used for self-checking
assert crosses(1, 1) == 0
assert crosses(5) == 1
assert crosses(5, 5) == 16
assert crosses(7) == 9
assert crosses(9, 0) == 0
print("The mission is done! Click 'Check Solution' to earn rewards!")
May 24, 2024
Comments: