08-04-2024, 02:49 PM
Code Challenge: Snacky Friends, a donkey, and Apples
|
08-05-2024, 03:28 PM
My friends and I aren't as gluttonous as you and your friends! Here's my solution, which doesn't necessarily work from the premise that they began with a whole number of apples -- I worked from the back end up, assuming that coming morning time, each person had at least full 1 apple and the donkey had 1.
Code: (Select All)
Quote:#1 #2 #3, Donkey Total
08-05-2024, 03:35 PM
See 40.75 apples, that's those worm laden apples Steve's got on his farm, feeds humans and birds
b = b + ...
08-05-2024, 03:40 PM
(08-05-2024, 03:35 PM)bplus Wrote: See 40.75 apples, that's those worm laden apples Steve's got on his farm, feeds humans and birds That 0.25 is the part where they cut out around the worms the day before. Is mine actually right though? My brain tells me it is, but I'm wondering why my numbers don't match any of yours at any point. The logic seems sound... I think?
08-05-2024, 03:45 PM
There was an underlying assumption of whole numbers I am pretty sure.
This problem is so similar to Rosetta Codes: https://rosettacode.org/wiki/Sailors,_co...ey_problem You can compare results 3 friends to 5 sailors, apples to coconuts and monkey to donkey.
b = b + ...
08-05-2024, 03:52 PM
(08-05-2024, 03:45 PM)bplus Wrote: There was an underlying assumption of whole numbers I am pretty sure. Pah! I always like to work at it with an out-out-the-box thinking. Always impresses the suits looking to hire you. "Gosh, this guy seems like he might find solutions for us nobody else can! Quick, hire him and give him a raise!" 2nd bonus? Since it's non-standard solutions, the guys in charge of hiring can't usually point out your mistakes and prove you wrong.
08-05-2024, 04:02 PM
1 + 1 = bigger 1. I didn't last to long at my job in the states with that solution, but did find life-long employment in North Korea.
Pete - Never think outside the box that's filled with cookies.
Shoot first and shoot people who ask questions, later.
08-05-2024, 04:06 PM
I like creative outside-the-box ideas too, why I am here all the time! I like first to try the challenge before I check anyone else solution though. You can really appreciate others views after trying it yourself.
More than one way to skin a cat, just an expression @PETA I would look at THE SOLUTION and assume I blundered usually from NOT reading carefully the rules. Steve looks at solution and says I am amazing to find this outside-the-box solution that nobody else has found!
b = b + ...
08-05-2024, 04:26 PM
See if this holds up. These guys may eat a few less than you think:
Code: (Select All)
'51 'friend 1 ate 17... donkey gets 1... 33 left 'friend 2 ate 11... donkey gets 1... 21 left 'friend 3 ate 7 ... donkey gets 1... 13 left 'morning everyone ate 4, donkey gets 1
08-05-2024, 04:29 PM
When I need answers to difficult programming approaches, I consult Clippy... then do the opposite. Works every time! Clippy, the Anti-Maze.
Pete
Shoot first and shoot people who ask questions, later.
|
« Next Oldest | Next Newest »
|
Users browsing this thread: 1 Guest(s)