1121. Taxation With Representation Overdone

单点时限: 2.0 sec

内存限制: 256 MB

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 consists of multiple datasets, one per line. Each correct line contains three pieces of information:

  1. Tax rate

  2. A tax rate always has a ‘%’ after it if it is a whole number (i.e. 5%).

  3. A tax rate never has a decimal point in it.

  4. A tax rate may contain a fraction but its denominator must only be a 2, 4, or 8.

  5. A tax rate must have a numerator that is less than its denominator.

  6. Contract End Date

  7. 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

  2. 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. For example, the cur rent 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%

输出格式

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 INPUT, 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.

样例

Input
25/850812-31
6%*****02110122
6.75% 2-11 4-23
Output
<Kalii Index=1>
****<startdate>31DEC03</startdate>
****<rate>2.625<rate>
****<enddate>15MAY08</enddate>
</Kalii>
<Kalii Index=2>
****<startdate>22JAN04</startdate>
****<rate>6.000</rate>
****<enddate>15FEB11</enddate>
</Kalii>
<Kalii Index=3>BAD DATA</Kalii>
hint *为空格

1 人解决,6 人已尝试。

2 份提交通过,共有 25 份提交。

9.9 EMB 奖励。

创建: 17 年前.

修改: 6 年,8 月前.

最后提交: 3 年,5 月前.

来源: N/A

题目标签