cswork / OA打开练习工作台

OptiverOA #3

Days Between

简单可在线判题

考点(AI 标注)位运算模拟/实现

Given two valid dates, where the first is earlier than the second, compute the number of days elapsed between them, without using system date objects or date-difference functions.

输入格式

The input is six integers year1 month1 day1 year2 month2 day2. The months and days must form valid proleptic Gregorian dates, and the first date is earlier than the second. The original problem does not restrict the year; this site explicitly restricts 1≤year1,year2≤9999.

输出格式

Output the number of days between the two dates, not counting the start day.

样例 1

输入:

2010 5 1 2011 5 1

输出:

365

样例 2

输入:

2020 2 27 2020 3 1

输出:

3

样例 3

输入:

2019 12 31 2020 1 1

输出:

1

样例说明

Use the Gregorian leap-year rule: a year divisible by 4 is a leap year, except century years, which must also be divisible by 400. The year limit of 9999 was added by this site to keep int output safe; it is not a constraint of the original problem.