Re:“The following surprisingly difficult problem was given t...
by Tloewald on Tuesday October 21, 2014 @09:39AM
(#8487229)
Setting aside the trivial arithmetic error, I think a simpler attack approach comes from the first two farmers collectively having 26 chickens and making twice as much money as the third, giving you a simpler starting point.
Re:“The following surprisingly difficult problem was given t...
by _paulc on Tuesday October 21, 2014 @07:37AM
(#8486840)
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]))
Re:“The following surprisingly difficult problem was given t...
by botzi2001 on Tuesday October 21, 2014 @07:29AM
(#8486822)
One small mistake at the end:
x = $1.25
y = $3.75
Re:“The following surprisingly difficult problem was given t...
by rileyjshaw on Tuesday October 21, 2014 @03:18PM
(#8489232)
o______o
oh my. this is why one shouldn't do math at 4am.
:s/4.25/3.75
From this information, we know that:
Let's isolate the first and second farmers here: We can do the same between farmers 1 and 3: These two formulas yield, Since a > b > c, Since farmer 1 only has 10 chickens, Since you can't sell negative chickens, And since the problem isn't very interesting if the farmers are allowed to sell half-chickens, a, b, and c (and the difference between them) are integers.Given all of this, 0 ≤ (a - b), (a - c) ≤ 10. The only numbers that satisfy this and,
are, Since c ≥ 0 and a ≤ 10, we have three triplets to consider: We can find the relationship between x and y from an earlier equation: So the farmers reduced their price to a third of the original price during the afternoon. What a deal!We've got a few equations that look like,
Which we can now simplify to, By plugging [10, 9, 8] into the above formula, the only value that gives us a proper dollar amount for y is a = 9.So...
Reading through the G+ comments it looks like someone beat me to it, but I figured I'd share my solution anyway.*This is assuming that they didn't decide to "sell" their chickens for $0 in the afternoon, which is probably a safe bet.
Edit: add intermediate steps for clarity