#P1178. 到天宫做客
到天宫做客
Description
One day I had a dream. I was honored to receive an invitation from Zhu Bajie to go to the Heavenly Palace and drink with him. I hesitated. One day in heaven equals one year on Earth! Of course, I am an idle person, and there are not many days in the year when I must stay on Earth. Therefore, I want to choose the longest continuous free period so that I can stay in heaven as long as possible. Remember, this year is the year . One day in heaven is also 24 hours, each hour 60 minutes, and each minute 60 seconds.
Input Format
The first line contains a non-negative integer , the number of days in the year when I must stay on Earth.
The next lines each contain two positive integers separated by a space, representing a date (month, day). The input is guaranteed to be valid, and dates are not repeated.
Output Format
A non-negative integer: the time spent in heaven (rounded to the nearest second).
2
3 8
12 2
63266
Hint
Sample Explanation (added on 2023.9.29)
The year is a leap year with days, and February has days.
The longest continuous free period is from March to December , a total of days. This corresponds to seconds.
Translated by ChatGPT 5
京公网安备 11011102002149号