#T564. 系统升级
系统升级
Description
As is well known, the OJ system undergoes periodic updates, but the OJ team consists of a total of n members. The administrator hopes that all of them can simultaneously receive the system upgrade notification sent via the OJ site, and the message is automatically sent once the system upgrade is completed. However, site notifications are sent in batches once every hour, precisely on the hour. To ensure the members' rest time, notifications can only be sent between 8:30 AM and 9:00 PM. If the system upgrade is completed at or after 9:00 PM, the message will be sent in the next batch at 8:00 AM the following day.
Now, the administrator wants to know how long it will take after the system upgrade is completed for the OJ team members to receive the site notification.
Input Format
The input consists of a single line:
Two numbers, h and m, representing the hour and minute when the system upgrade is completed.
Output Format
Output a single number representing the duration in minutes (converted from hours to minutes) from the completion of the system upgrade until the team members receive the site notification.
If the input format is invalid, output the uppercase letter X.
18 7
53
21 0
690
15 0
0
Source
CodesOnline Original Problem