Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
Statistical Charts
Submit Problem
Online Status
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Taxation With Representation Overdone
Time Limit: 1000MSMemory Limit: 10000K
Total Submissions: 207Accepted: 55


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
- 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.
2. 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).
3. 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. 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):
<Kalii Index=N>

<startdate>(start date)</startdate>
<rate>(tax rate)</rate>
<enddate>(end date)</enddate>

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 <Kalii Index=N >BAD INPUT</Kalii>, 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

6% 02110122
6.75% 2-11 4-23

Sample Output

<Kalii Index=1>
<Kalii Index=2>
<Kalii Index=3>BAD DATA</Kalii>


[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator