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

建议使用的浏览器:

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

2077:Balanced Budget Initiative

题目描述
After bouncing 10 checks last month, you feel compelled to do something about your financial management. Your bank has started providing you with your statement online, and you believe that this is the opportunity to get your account in order by making sure you have the money to cover the checks you write.
Your bank provides you with a monthly statement that lists your starting balance, each transaction, and final balance. Your task is to compare the statement with the transactions from your checkbook register over the same time interval. You will identify transactions that appear in only the statement or register, as well as incorrect amounts recorded in the register (naturally the bank's statement is always correct) and math mistakes in your register.
输入解释
The bank statement appears first. It begins and ends with lines of the form:
balance < X >
with the first line indicating the starting balance and the second line indicating the final balance.
In between the balances is the list of transactions, one per line, in the form:
{check|deposit} < N > < X >
Where N is the integer check or deposit number (the same check or deposit number will only appear once, although the same number can apply to both a check and deposit), and X is the amount of the transaction.
Following the final balance the register entries appear. The first line of the register is the starting balance
< X >
Following are pairs of lines, with the next transaction appearing followed by the balance you calculated by hand after entering the transaction.
{check | deposit} < N > < X >
< X >
The pairs repeat until the end of the input file.
For all input numbers and intermediates, |X| < 1000000. All dollar amounts are given to the penny (0.01).
输出解释
For ease correcting your register, the output for each transaction occurs in the order it appears in the register. Each register entry receives exactly one line in the output.
If the register entry is entirely correct, meaning that it is found in the statement for the same amount, the math in the register is correct, and it is not a duplicate entry for a transaction previously found in the register, then output the line
{check|deposit} < N > is correct
However, if the transaction is not entirely correct, you will output a single line beginning with the transaction type and number, and one or more of the following mistakes, whitespace separated, in this order:
  • is not in statement the transaction type and number do not occur in the statement
  • repeated transaction the transaction has occurred previously in the register
  • incorrect amount the register amount is different than the statement amount
  • math uses correct value the math uses the value from the statement, although the actual transaction amount is recorded incorrectly in the register. This can only appear if incorrect amount is also displayed.
  • math mistake the register balance after the transaction matches neither the statement amount for the transaction, nor the register entry for the transaction (if different than the statement amount)

Following the line for the final entry in the register, a listing of all transactions missing from the register will be printed. These items must be printed in ascending order (check < deposit , 1 < 2 < 3 ... ), one per line:
missed {check|deposit} < N >
输入样例
balance 1000.00
check 100 10.00
check 101 20.00
check 102 30.00
check 103 100.00
deposit 1 10.00
deposit 2 20.00
deposit 3 30.00
deposit 4 500.00
balance 1400.00
1000.00
check 100 10.00
990.00
deposit 2 25.00
1015.00
check 101 20.00
990.00
check 102 30.00
960.00
check 101 21.00
940.00
check 103 100.00
840.00
deposit 3 30.00
870.00
deposit 4 500.00
1370.00
输出样例
check 100 is correct
deposit 2 incorrect amount
check 101 math mistake
check 102 is correct
check 101 repeated transaction incorrect amount math uses correct value
check 103 is correct
deposit 3 is correct
deposit 4 is correct
missed deposit 1

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

题目来源 Mid-Atlantic 2004

源链接: POJ-2077

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

共提交 0

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