You are in a room with three switches labeled A, B, and C. Each switch controls one of three light bulbs in another room, which you can't see. Initially, all the light bulbs are turned off. You are allowed to toggle the switches however you like, but once you enter the room with the light bulbs, you cannot change the switches again. How can you determine which switch controls each light bulb with only one visit to the room with the bulbs?
Turn on switch A and leave it on for a few minutes.
Turn off switch A and turn on switch B.
Enter the room with the light bulbs.
Now, observe the state of the light bulbs:
The bulb that is turned on is controlled by switch B, as it's the only switch currently on.
The bulb that is turned off but warm to the touch is controlled by switch A because it was turned on long enough to heat up the bulb and then turned off.
The bulb that is turned off and cool to the touch is controlled by switch C because it has not been turned on at all.
By following these steps, you can determine which switch controls each light bulb with only one visit to the room with the bulbs.