Laptop
Time limit2sMemory limit1024 MB
Given the times when a laptop switches between mains and battery, find the battery charge percentage at 23:59, with full charge taking y minutes and full drain taking x minutes.
- Level
Easy2 of 10
- Topics
- Simulation, Implementation
- Solved
- No attempts yet
Statement
Не было печали, апдейтов накачали.
Интернет-фольклор
Vova recently bought a new laptop. After buying it, he installed his favorite operating system, winBSD, and ran it without interruption for several weeks as an experiment.
During that time Vova found that on battery power the laptop is fully drained after minutes of continuous operation of the system. winBSD consumes the same amount of battery energy per unit of running time, no matter which tasks it performs.
When the laptop runs on mains power, the battery is fully charged in minutes (with the system running). Likewise, the battery gains the same amount of charge per unit of winBSD running time.
Vova moves around the city often, so the laptop switches its power source (from mains to battery and back) times during the day. At the start of the day (00:00) the laptop runs on mains power and the battery is fully charged.
After a winBSD update, the battery charge indicator stopped working. Write a program that takes the schedule of power source switches and determines the battery charge at the end of the day.
Input
The first line contains the integers , , and (, ). Each of the next lines contains a time of day in the format hh:mm when the power source was switched. The times are between 00:01 and 23:58, are given in chronological order, and are pairwise distinct.
Output
Print the battery charge percentage at 23:59 with an accuracy of at least three decimal places.