Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1097021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:22:07+00:00 2026-05-17T00:22:07+00:00

Some student asked this on another site, but got no answers. I had a

  • 0

Some student asked this on another site, but got no answers. I had a few stabs at it, but found it pretty tricky.

Doing it with just the switches would require a 9:1 compression ratio, so I guess the trick is very much in the rules you assign to students. Perhaps every student needs a different set of rules?

I’ve thought about allowing many iterations where no answer comes up, by only paying attention to students in the correct sequence. I’ve also thought about encoding the student number as binary, and combining that with the bits from the switches, to get more bits to work with, but that’s still a compression/validation problem: even if one of those bits was used for parity, you’d still have a big potential for false positives.

Presumably the problem wouldn’t have been asked if there wasn’t some way to do it. Maybe this is a common problem in comp-sci courses and well-known? Anyway, without further ado…

“Here is a problem I have for a computer class. It’s seems kind of mathematical to me and could possibly involve the binary code. I’m not sure, all my ideas lead to dead ends.

Nineteen students are given the opportunity to win a prize by playing a game. After some time to decide on a strategy, all the students will be placed into separate soundproof isolation chambers with absolutely no way to communicate.

The game is played as follows. There are two light switches in a room that will begin in the “off” position. I will bring students into this room one at a time. Each time a student enters the room then he or she must flip one of the switches. All the students will eventually be brought into the room, but some students may be brought in more than one time.

If one person correctly tells me that everyone has been in the room, then everyone wins the prize. However, if someone incorrectly tells me that everyone has been in the room then everyone will be fed to the alligators! Note that either all the students win the prize or else everyone loses.

Your task is to determine a strategy that will be sure to allow everyone to win the prize (and not be eaten by alligators).”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T00:22:07+00:00Added an answer on May 17, 2026 at 12:22 am

    This sounds like a variation of the Prisoners and the Light Switch riddle, where one prisoner is designated as a “counter” and everyone else “increments their count” only once.

    Presumably the counter would turn on one switch, and if you had never been counted, you would turn off that switch; the other switch would be “garbage”. Once the counter turned off the switch 18 times, he knows that all other students have been to the room.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a search box on my site. If a student enters some text,
I have some C++ code that looks like this: void Student::addCourse(Course cVal, string gr)
This question hasn't been asked yet. Some solutions probably have been proposed though to
I'm a student with quite some experience in Java but totally new to Maven.
I had some problems printing out a student store with which I used an
I'm a student, so please bear with me! I've got some introductory Java (using
I have a table that includes some student group name, lesson time, day names
I have some data (Student info), and my app should be able to read
I work with my student group on a project : We have some problems
I am a graduate student of physics and I am working on writing some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.