Tuesday, March 10, 2009

My Ping Pong Problem

While writing up some new and original logic problems for the PyWhip site, I came up with this one, which kept several teachers in our math department (and a student) entertained during lunch:

Imagine that we have some ping pong tables and need to have them "sealed" before the next round of competition. It takes one worker 10 minutes per table to get it properly sealed and cleaned up. It takes two workers 5 minutes per table, as they can each work on a half. Only two workers can work on a table at one time, though, so three workers also would take 5 minutes on one table. All we care about in this problem is how long it takes for the work crew to be done with the table "resealing" job so we can get the next round of a tournament started.

Your job:

Write a function that accepts two parameters (numberOfWorkers , numberOfTables) and have it return the total number of minutes it will take for the work crew to get the job done.

No comments: