2546
you are viewing a single comment's thread
view the rest of the comments
[-] ChairmanMeow@programming.dev 3 points 9 months ago

You don't know if the person is lighter or heavier yet.

[-] Sagifurius@lemm.ee 1 points 9 months ago* (last edited 9 months ago)

That's not the question. Either the scales balance, and the third is heavier or lighter, or the scales don't balance and you get both answers, but the question is purposely framed this way

[-] ChairmanMeow@programming.dev 2 points 9 months ago

I mean that not knowing it is part of the question, and the proposed solution doesn't work without knowing if the person is heavier or lighter.

If you know if the person is heavier or lighter, the question becomes trivial.

[-] Sagifurius@lemm.ee 0 points 9 months ago

The question is to figure out who is different, not how they are different. That takes one more step, half the time.

[-] ChairmanMeow@programming.dev 2 points 9 months ago

Yes, I'm aware. But with 12 people you can't simply divvy the groups in threes constantly, because if you weigh and the groups are unequal, then you don't know in which group the different person is (yet). E.g., weighing ABCD - EFGH can tell you the different person is in IJKL if the groups are even, but if they're uneven you don't know in which of the other two groups the different person is.

[-] Mr_Dr_Oink@lemmy.world 0 points 9 months ago

The question was to find who doesnt weigh the same and if its heavier or lighter. Watch the clip again.

[-] Sagifurius@lemm.ee 1 points 9 months ago

That's easy enough to answer, but he really should work on his grammar. In that case you just do 3 groups of three, weigh two of them. If they're even, the third group is different. Weigh 2 membres of the third group, they'll either be even or one heavier. Weight the last member against the heavier one from step 2 to see if they're even or not for your answer.

[-] Mr_Dr_Oink@lemmy.world 1 points 9 months ago

Thats 4 uses of the seesaw. It has to be 3.

[-] Sagifurius@lemm.ee 1 points 9 months ago
[-] Mr_Dr_Oink@lemmy.world 2 points 9 months ago* (last edited 9 months ago)

Im sorry when i read weigh two of them i counted it as two separate weighings of two sets of groups. My bad.

What about the 4th group? There are 12 people

[-] Sagifurius@lemm.ee 1 points 9 months ago* (last edited 9 months ago)

Well I meant to write 3 groups of four. Same general thought just adjust the logic somewhat

[-] Mr_Dr_Oink@lemmy.world 1 points 9 months ago* (last edited 9 months ago)

I've had a look into it, and it doesn't work if you try to do it mathmatically. You always need more than 3 gos on the seesaw.

There is a solution in the replies to my original comment that is the actual solution, and it works every time and is much simpler than any grouping method.

It involves assigning a letter to each person and then aligning that with a grid of positions "left" or "right" or "none" on the seesaw. Over the three rounds. So, person A is on the right all three rounds person b is on the right for 2 rounds then on the left for the 3rd round.

You end up with a list of 12 patterns that do not repeat or mirror any other pattern like "LLL" "LLR" "LRR" "LR-" etc. Then you do all three rounds and compare the position the seesaw was in with those patterns.

If the seesaw was down on the left 2 times the down on the right the third time then you look for which person had that pattern in this case it was person B. So they are the one with a different weight and they were heavier.

Equally, if the opposite pattern occurred. It was down on the right 2 times, then down on the left for round, then that is the opposite pattern of person B and does not occur anywhere else, so it was person B, and they were lighter.

person:  A B C D E F G H I J K L

round 1: L L L L R R R R — — — -

round 2: L L R R R — — — L R L -

round 3: L R R — — L R — L L — R
this post was submitted on 30 Nov 2023
2546 points (99.6% liked)

Programmer Humor

19166 readers
1716 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS