#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cmath>
using namespace std;
int main()
{
int year, month, day;
cin >> year >> month >> day;
int a, b, c;
cin >> a >> b >> c;
int x = 0;
if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)//判断闰年
{
for (int i = 1; i < month; i++)
{
if (i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10 || i == 12)
{
x = x + 31;
}
else if (i == 2)
{
x = x + 29;
}
else
{
x = x + 30;
}
}
x = x + day;
}
else
{
for (int i = 1; i < month; i++)
{
if (i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10 || i == 12)
{
x = x + 31;
}
else if (i == 2)
{
x = x + 28;
}
else
{
x = x + 30;
}
}
x = x + day;
}
int y = 0;
for (int i = year; i < a; i++)
{
if ((i % 4 == 0 && i % 100 != 0) || i % 400 == 0)//判断闰年
{
y = y + 366;
}
else
{
y = y + 365;
}
}
int m = y - x;
x = 0;
if ((a % 4 == 0 && a % 100 != 0) || a % 400 == 0)//判断闰年
{
for (int i = 1; i < b; i++)
{
if (i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10 || i == 12)
{
x = x + 31;
}
else if (i == 2)
{
x = x + 29;
}
else
{
x = x + 30;
}
}
x = x + c;
}
else
{
for (int i = 1; i < b; i++)
{
if (i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10 || i == 12)
{
x = x + 31;
}
else if (i == 2)
{
x = x + 28;
}
else
{
x = x + 30;
}
}
x = x + c;
}
cout << m + x << endl;
return 0;
}
c++离开家的天数
最新推荐文章于 2024-10-05 21:10:28 发布