当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2846:The Bank of Kalii

题目描述

Customers of the Bank of Kalii handle their banking transactions similar to the way they handle their taxes: be as terse as possible. As a result, when a customer writes a check or fills out a deposit or withdrawal form, they leave off the year on any date they write down. So, instead of writing: 09/20/2005, they would write: 9/20 and be done with it. In general, the year can be inferred since it will be relatively close to the date the transaction is actually processed by the bank.

Without going into the intricate details of how the Bank of Kalii calculates interest and banking fees (that is a problem for another time...), suffice to say the bank must determine the actual date the customer wrote on the check or form, and calculate the number of days prior (or in the future) the document is dated. You see, Kaliian bankers, like their government officials, are overworked, so they may not get around to processing transactions for up to a week. The customers know this, so they often date their checks and forms a several days in the future - this complicates the bankers' duties as well.

Your job is to write a program to compare a date written on a check or form with the date the transaction is being processed, and, determine the full date the customer meant as well as how many days prior (or in the future) the document is dated.

输入解释
The first line of input contains an integer N which is the number of datasets that follow (1 ≤ N ≤ 1000). Each dataset consists of a single line containing two dates: the transaction date and the document date; there is a single space between them. The transaction date is of the form M/D/Y where M is the month number (1 ≤ M ≤ 12), D is the day of month (1 ≤ Dmd1) and Y is the year (2000 ≤ Y ≤ 2200). The document date is of the form m/d where m is the month number (1 ≤ m ≤ 12) and d is the day of month (1 ≤ dmd2). The values of md1 and md2 will not exceed the number of days in the respective months M and m.
输出解释

For each dataset print out the dataset number followed by a space followed by the result of the date comparison as shown in the table below:

Result to print Criteria
m/d/y IS n DAY(S) PRIOR If the document date occurs before the
transaction date and is within 7 days in the past
m/d/y IS n DAY(S) AFTER If the document date occurs after the transaction
date and is within 7 days in the future
SAME DAY If the dates are the same.
OUT OF RANGE All other results not with +/− 7 days.

输入样例
7
11/20/2005 11/21
11/20/2005 11/17
11/20/2005 11/20
11/20/2005 11/13
11/20/2005 11/28
1/2/2005 12/30
12/31/2100 1/3
输出样例
1 11/21/2005 IS 1 DAY AFTER
2 11/17/2005 IS 3 DAYS PRIOR
3 SAME DAY
4 11/13/2005 IS 7 DAYS PRIOR
5 OUT OF RANGE
6 12/30/2004 IS 3 DAYS PRIOR
7 1/3/2101 IS 3 DAYS AFTER

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 Greater New York 2005

源链接: POJ-2846

最后修改于 2020-10-29T06:45:41+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536