#include <iostream>
using namespace std;
class Date
{
friend istream& operator>>(istream& in, Date& d);
public:
Date(int year, int month = 1, int day = 1)
{
_year = year;
_month = month;
_day = day;
}
int GetMonthDay(int year, int month) const {
static int monthDayArr[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int day = monthDayArr[month];
if (month == 2 && ((year % 400 == 0) || (year % 4 == 0 && year % 100 != 0))) {
day += 1;
}
return day;
}
bool operator!=(const Date& d) const {
return (_year != d._year) || (_month != d._month) || (_day != d._day);
}
Date& operator+=(int day) {
_day += day;
while (_day > GetMonthDay(_year, _month)) {
_day -= GetMonthDay(_year, _month);
_month++;
if (_month == 13) {
_year++;
_month = 1;
}
}
return *this;
}
Date& operator++() {
*this += 1;
return *this;
}
int operator-(const Date& d)
{
// *this 大,d 为小
Date max = *this, min = d;
int cnt = 1;
while (max != min)
{
++min;
++cnt;
}
return cnt;
}
public:
int _year;
private:
int _month;
int _day;
};
istream& operator>>(istream& in, Date& d)
{
in >> d._year >> d._month >> d._day;
return in;
}
int main()
{
Date d1(1); // 输入
cin >> d1;
Date d2(d1._year);
cout << (d1 - d2) << endl;
}