Problem 114

completed January 24, 2012

Comments

This one was just like problem 117. Didn’t even take that long to change the code up for it.

Code

bound = 50
count = 0

colorDict = dict()

for k in xrange(-1, bound+1):
	colorDict[k] = 0

for length in range(3, bound+1):
	for start in range(1, length):
		for end in range(3, bound+1):
			if start + end - 1 > length: continue
			colorDict[length] += 1
			colorDict[length] += colorDict[length-(start+end)]

count = colorDict[bound] + 1
print count