An incentive scheme aimed at reducing patients' waiting times in accident and emergency departments was introduced by the UK government in 2000. It requires 98 percent of patients to be discharged, transferred, or admitted to inpatient care within 4 hours of arrival. Setting the minimal hour by hour medical staffing levels for achieving the government target, in the presence of complexities like time-varying demand, multiple types of patients, and resource sharing, is the subject of this paper. Building on extensive body of research on time dependent queues, we propose an iterative scheme which uses infinite server networks, the square root staffing law, and simulation to come up with a good solution. The implementation of this algorithm in a typical A&E department suggests that significant improvement on the target can be gained, even without increase in total staff hours.