文章
105
粉丝
69
获赞
117
访问
56.1k
#include<bits/stdc++.h>
using namespace std;
const int months[] = {
0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};
bool cheak(int y)
{
if((y % 100 != 0 && y % 4 == 0 ) || y % 400 == 0)
return true;
return false;
}
int get_sum(int y, int m, int d)
{
int sum = 0;
for(int i = 1; i < y; i ++)
sum += (365 + cheak(i));
for(int i = 1; i < m; i ++)
if(i == 2) sum += (months[i] + cheak(y));
else sum += months[i];
sum += d;
return sum;
}
int main()
{
int y1, m1, d1, y2, m2, d2;
while(~scanf("%04d%02d%02d%04d%02d%02d", &y1, &m1, &d1, &y2, &m2, &d2))
{
cout << abs(get_sum(y1, m1, d1) - get_sum(y2, m2, d2)) + 1<< endl;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发