Files
euler/python/e147.py
2024-06-13 11:35:11 -04:00

36 lines
684 B
Python

from math import ceil
def combs_orth(rows, cols):
count = 0
for r in range(1, rows + 1):
for c in range(1, cols + 1):
cr = ceil(rows / r)
cc = ceil(cols / c)
count += cr * cc
return count
def combs_vert(rows, cols):
return 0
def combs(rows, cols):
return combs_orth(rows, cols) + combs_vert(rows, cols)
def euler_147():
# assert combs(1, 1) == 1
# assert combs(2, 1) == 4
# assert combs(3, 1) == 8
# assert combs(2, 2) == 18
assert combs(2, 3) == 37 - 19
return 0
if __name__ == "__main__":
solution = euler_147()
print("e147.py: " + str(solution))
# assert(solution == 0)