There are three switches outside a closed room. There are three lamps inside the room. You can flip the switches as much as you want while the door is closed, but then you must enter just once and determine which switch is connected to which lamp.
How can you do that?