Problem 116

Red, green, and blue tiles

Problem 118

Red, green, and blue tiles

Problem 117

Using a combination of grey square tiles and oblong tiles chosen from: red tiles (measuring two units), green tiles (measuring three units), and blue tiles (measuring four units), it is possible to tile a row measuring five units in length in exactly fifteen different ways.
png117.png
How many ways can a row measuring fifty units in length be tiled?
NOTE: This is related to Problem 116.
from tools import memoize_two_values


@memoize_two_values
def ways(l, blocks):
    if l > 0:
        return sum(ways(l - i, blocks) for i in blocks if l - i >= 0)
    return 1


def run():
    return ways(50, (1, 2, 3, 4))