编程介的小学生 2017-02-25 14:52 采纳率: 20.5%
浏览 787
已采纳

Taxation With Representation Overdone

In the land of Kalii lived a civilization not unlike our own. They had government, business, and technology. The only major difference was how tax rates were decided. You see, the people of Kalii loved to haggle. They haggled over everything including what percentage of their income went to the government coffers. When a Kalii family's tax contract was up they had to travel to the capital to haggle with government officals and hammer out a new deal. The contract would have a start date, an end date (for bookkeeping purposes the end day was always the 15th of the end month), and a tax rate. It was also traditional for a Kalii family to enjoy a short time period of tax free living between the end of their last contract and the start of the new one. This time period was a point to haggle over as well.
The land of Kalii was prosperous and very populous and, as a consequence, government officials were often overwhelmed with work. When a deal was agreed upon with a family, the officials would quickly write it down in shorthand and send it off to be processed. These scribbled notes had to be converted to XML format to be entered into their computer system. Sometimes the scribble was inconclusive and the family would have to be recalled to the capital for another round of haggling. This entire process was very inefficient but it was the way the people of Kalii had always done it and they were not about to change anytime soon.

Your job is to convert the scribblings of the officials into XML format.

Input

Input consists of multiple datasets, one per line. Each correct line contains three pieces of information:

  1. Tax rate
  • A tax rate always has a '%' after it if it is a whole number (i.e. 5%).
  • A tax rate never has a decimal point in it.
  • A tax rate may contain a fraction but its denominator must only be a 2, 4, or 8.
  • A tax rate must have a numerator that is less than its denominator.
  1. Contract End Date
  • A contract end date is a numerical representation of the month (one or two digits) and the last two digits of the year. The month and year may be separated by a single hyphen (i.e. 12-05 or 1205 would refer to 15DEC05).
  1. Contract Start Date
  • A contract start date is a numerical representation of the month (one or two digits) and a two-digit day of the month. The month and day may be separated by a single hyphen (i.e. 12-05 or 1205 would refer to 05DEC03).
  • A contract start date must start on or after the current date. (Suppose it's the beginning of November, 2003.) For example, the current year is 2003. If the start date is 305 it is assumed that the year the contract starts will be 2004.

Note: There may be 0 or more spaces between each of the three fields.
Note: The Kalii calendar consists of the twelve months familiar to you, but all months have 31 days.
Note: The maximum tax rate is 99.875%

Output

For each data set, print the correctly indented XML (4 spaces per indent level):


(start date)
(tax rate)
(end date)

N should be replaced by the data set number, (start date) by the start date, (tax rate) by the tax rate, and (end date) by the end date. If no output could be computed because of either bad or ambiguous data, simply print BAD DATA, where N should be replaced by the data set number.

Note: The format for the start date is DDMMMYY. The format for the end date is 15MMMYY. Where DD is the zero-padded day of month (01-31), MMM is the month in upper-case letters (JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC), and YY is the zero-padded last 2 digits of the year (00-99).
Note: The tax rate should be accurate to 3 decimal places.

Sample Input

25/850812-31
6% 02110122
6.75% 2-11 4-23

Sample Output


31DEC03
2.625
15MAY08


22JAN04
6.000
15FEB11

BAD DATA

  • 写回答

2条回答 默认 最新

  • threenewbee 2017-03-03 15:41
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!