|
|
|
|
|
by _paulc
4254 days ago
|
|
Except that I get a different answer if you do a very simple bruteforce: def check(n,am,pm,total):
for x in range(1,n):
if (am * x + pm * (n-x)) == total:
return "AM: %d @ %d / PM %d @ %d" % (x,am,n-x,pm)
return None
def solve(total,birds):
for am in range(1,total):
for pm in range(1,am):
result = list(map(lambda n:check(n,am,pm,total),birds))
if all(result):
return result
print(solve(3500,[10,16,26]))
|
|