#C4352. Inclusive Days Between Dates
Inclusive Days Between Dates
Inclusive Days Between Dates
In this problem, you are given several datasets. Each dataset consists of a year and two dates in the format m/d. For each dataset, you need to calculate the number of days between the two dates (inclusive) in that year. Note that the year might be a leap year. A year is a leap year if and only if it satisfies the following condition: [ \text{Leap Year} \iff \Big((year \mod 4 = 0 \text{ and } year \mod 100 \neq 0) \text{ or } (year \mod 400 = 0)\Big). ] The input ends with a dataset where the year is 0. You should not process this dataset.
Example: For the dataset 2020 1/15 2/15
the answer is 32 because there are 32 days from January 15 to February 15, 2020 (including both dates).
inputFormat
The input is read from standard input (stdin). Each line contains a dataset with three elements: an integer representing the year, a start date, and an end date (both in the format m/d). The input terminates with a line where the year is 0 (the other fields on this line can be ignored).
outputFormat
For each dataset (except the terminating one), output a single integer on a new line: the inclusive number of days between the start date and the end date.## sample
2020 1/15 2/15
2021 3/1 3/31
0 0/0 0/0
32
31
</p>