|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||256 MB||28||7||7||25.000%|
The company you work for, Automatic Conversation Machina, a text to speech service provider, has just won a contract for a telephone banking system. Unfortunately their text to speech software does not yet work with numerical values like the balance in a bank account. They need you to take a currency value and convert that to words so the software will be fully functional for the telephone banking system.
The conversion must work for values between negative
$999 999 999 999.99 and positive
$999 999 999 999.99. None of the bank’s customers are trillionaires just yet.
The value must be fully converted to words for all parts of the currency amount including the cents amount i.e.
zero dollars and
zero cents are to be included if the dollar or cents value are zero, respectively. The following rules must be observed:
twenty-one’ and ‘
and’ must appear after the word ‘
hundred’ in all cases except when the value being converted is a round hundred e.g. compare ‘
one hundred thousand’ with ‘
one hundred and twenty-three thousand’.
and’ must appear between the least of the billions, millions or thousands groups and the units group if the units group is less than one hundred except when the units group equals
0e.g. compare ‘
two thousand and forty-six’ with ‘
two thousand five hundred and fifty-seven’.
dollars’ must appear after the dollar amount except if the dollar amount is
1in which case the word ‘
dollar’ must appear.
and’ must appear between the dollars amount and the cents amount.
cents’ must appear after the cents amount except if the cents amount is
1in which case the word ‘cent’ must appear.
in debit’ must be added to the end of the amount.
in credit’ must be added to the end of the amount.
in debit’ or ‘
in credit’ must not be included.
The correct spelling for all values likely to be needed are:
The input contains a single test case.
The input will consist of one currency value v (−\$999 999 999 999.99 ≤ v ≤ \$999 999 999 999.99).
The output for the test case must be on a single line with a single space between each word. Note: The sample output is displayed over multiple lines so that it fits on the page.
one hundred and twenty-three billion four hundred and fifty-six million seven hundred and eighty-nine thousand and twelve dollars and thirty-four cents in debit
fourteen thousand and nineteen dollars and fifty cents in credit