1376:Calendar

时间限制:2 S   /  内存限制:65536 KB
AC:35   /  Submit:75
问题描述

Calendars in widespread use today include the Gregorian calendar, which is the de facto international standard, and is used almost everywhere in the world for civil purposes. The Gregorian reform modified the Julian calendar's scheme of leap years as follows:
Every year that is exactly divisible by four is a leap year, except for years that are exactly divisible by 100; the centurial years that are exactly divisible by 400 are still leap years. For example, the year 1900 is not a leap year; the year 2000 is a leap year.

输入描述

In the first line, the is a integer T (1≤T≤100), which means there T cases of this problem.
In every case, the input has two format:
1):  yyyy1:mm1:dd1 yyyy2:mm2:dd2
2):  yyyy1:mm1:dd1 day
If the format is the 1) type, your task is to calculate how many days are between yyyy1:mm1:dd1 and yyyy2:mm2:dd2.
Others, your task is output the date after the date yyyy1:mm1:dd1, and the days between them is day. The format of the answer is yyyy:mm:dd.
1000≤yyyy≤9999 and yyyy:mm:dd is a legal date.
0≤day, we can ensure the answer of the second type is satisfied with 1000≤yyyy≤9999.

输出描述

For every case, display the answer of this question per line.

样例输入复制样例

4
1900:01:01 2038:12:31
1900:01:01 50768
1996:03:09 1991:11:12
1991:11:12 1579

样例输出

50768
2038:12:31
1579
1996:03:09

来源
2017年第八届福建省大学生程序设计竞赛热身赛

Copyright 2016 - 2024 XUJC ACM Team
闽ICP备2020022076号-1