Hint 1

In any problem like this, you are trying to model something in the real world (or, the world of the story in this case) using the types and values of the computer or programming language.

In this problem, you have the hallway of lockers. What can be used to model the lockers? What information do you need to store about each locker? Make sure that for every variable you use that you can articulate clearly what the variable is for and what it is modeling.

Once you have that figured out, think about how you can manipulate the information (the variables) to simulate the opening and closing of the lockers and how to retrieve the necessary information at the end about the number of open and closed lockers, etc.


Thomas VanDrunen
Last modified: Mon Sep 15 16:46:38 CDT 2008