Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Peaceable Queens by imloafer
from math import floor, ceil
def peaceable_queens(size: int) -> int:
# your code here
return floor(7 * size * size / 48) if size != 5 and size != 9 else ceil(7 * size * size /48)
print("Example:")
print(peaceable_queens(3))
# These "asserts" are used for self-checking
assert peaceable_queens(1) == 0
assert peaceable_queens(2) == 0
assert peaceable_queens(3) == 1
assert peaceable_queens(4) == 2
print("The mission is done! Click 'Check Solution' to earn rewards!")
May 19, 2023