Workout for a Dumbbell: Difference between revisions

From programming_contest
Jump to navigation Jump to search
imported>Kmk21
Created page with "This is a pretty straightforward simulation problem. Cache the last known time a machine user started on their machine. Each time jim arrives at a machine, mod the current tim..."
 
(No difference)

Latest revision as of 02:51, 2 November 2017

This is a pretty straightforward simulation problem. Cache the last known time a machine user started on their machine. Each time jim arrives at a machine, mod the current time by the "total cycle time" of the fixed user of that machine. Also mod the cache'd last known start time of that machine user (assuming he is past his own start time). If modded start time plus the workout time (again mod total cycle time of that machine) is greater than the current modded time, then Jim has to wait. Calculate his wait time (difference between the two previously calculated values) to find out when he is able to start using the machine and when that machines user is next able to start using the machine. Update cached values accordingly and proceed.