Code Challenge: Snacky Friends, a donkey, and Apples - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Programs (https://qb64phoenix.com/forum/forumdisplay.php?fid=7) +---- Thread: Code Challenge: Snacky Friends, a donkey, and Apples (/showthread.php?tid=2902) |
RE: Code Challenge: Snacky Friends, a donkey, and Apples - bplus - 08-05-2024 Quote:See if this holds up. These guys may eat a few less than you think: Testing 51 51 / 3 = 17 R 0 fail need Remainder 1 to give to Donkey '52 / 3 = 17 R 1 52 - 17 - 1 = 34 '34 / 3 = 11 R 1 34 - 11 - 1 = 22 '22 / 3 = 7 R 1 so 7 for each '26 + 7 = 33 1st '17 + 7 = 24 2nd '11 + 7 = 18 3rd ' +4 Donkey ==================== = 79 It works alright (08-05-2024, 04:29 PM)Pete Wrote: When I need answers to difficult programming approaches, I consult Clippy... then do the opposite. Works every time! Clippy, the Anti-Maze. This reminds me of Seinfeld when George started succeeding in Life by doing the opposite of his first instinct. RE: Code Challenge: Snacky Friends, a donkey, and Apples - SMcNeill - 08-05-2024 Ah! I didn't count it as 3 and remainder of 1. I counted it as eat 1/3, feed the donkey 1 of the remaining. 2/3. RE: Code Challenge: Snacky Friends, a donkey, and Apples - Pete - 08-05-2024 I remember that episode. I had a friend, in high school, who was pretty close to George. In 1975 and 1976 he was rooting for the Oakland Raiders to make it to and win the Superbowl. Well, both those years Oakland didn't make it, and the Stealers won. So in 1977 he switched to the Stealers and as soon as I heard that, I called him a fool and said that this is the year Oakland will win it all. He was so pissed he bet me $5.00, on the spot, and I took that bet. Congrats to the 1977 Superbowl champion Oakland Raiders! They have their rings, and I have my $5.00 framed and hanging in my mancave. Edit: It's not Steve's fault. I don't think he grows apples. He could. Amazingly enough, they do quite well in Virginia climate and soil, and unlike Washington state apples, they don't roll to the left. Pete RE: Code Challenge: Snacky Friends, a donkey, and Apples - SMcNeill - 08-05-2024 Just got back to home. Here's the answer with the "Divide by 3, with a remainder of 1", rather than my previous "Divide by 3, give 1 from the remaining". Simplified down to 8 lines of code: Code: (Select All)
RE: Code Challenge: Snacky Friends, a donkey, and Apples - bplus - 08-05-2024 sweet! RE: Code Challenge: Snacky Friends, a donkey, and Apples - bplus - 08-06-2024 So testing what we've learned: How many apples do you need at minimum if you don't give the donkey an apple in the morning? Hint: considerably less! RE: Code Challenge: Snacky Friends, a donkey, and Apples - SMcNeill - 08-06-2024 (08-06-2024, 07:24 AM)bplus Wrote: So testing what we've learned: Donkey, hell! Don't give the first guy any. he's got to be even fatter than me! RE: Code Challenge: Snacky Friends, a donkey, and Apples - bplus - 08-06-2024 OK then 3 Friends, Apples and Steve who needs no apples, just a music festival roll into the neighborhood once or twice a summer. Update: Oh wow! Look at all the apples needed if you aren't giving an apple to a donkey at each divy! Unless I miscalculated, its more than 79. ?? RE: Code Challenge: Snacky Friends, a donkey, and Apples - JRace - 08-06-2024 Keeping it to whole apples only, looks like the minimum is 81... the next multiple of 3 (or 9) above 79. Code: (Select All) Total FatBoy Friend2 Friend3 Donkey RE: Code Challenge: Snacky Friends, a donkey, and Apples - bplus - 08-08-2024 Yes Just got Internet back from Tues 4:30PM storm, here are my calcs for the 2 followup questions: Code: (Select All) ' Charlies orig problem solution |