| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 21 | 11 | 8 | 44.444% |
You have just been hired to the Fixing Good lawyer team as an editor. Your boss, Saul Badman, is an incredible lawyer, but has one small quirk: he always forgets to spell out numbers as words in his reports.
It is customary in formal documents to write out numbers, and unfortunately for Saul, he is dealing with lawsuits which involve lots of numbers. Saul forgets to write out numbers so often that you decide it would be easier to write a program that does the job.
Your task is to translate a given number into the corresponding English word(s). For instance, 5280ドル$ becomes "five thousand two hundred eighty".
If a number is in the ones place after a number in the tens place, it should have a dash between the words representing the tens and ones places, such as 45ドル$ becoming "forty-five". This rule applies to thousands as well, such as "forty-five thousand".
You should not include "and" nor "," in your answer.
For a full word to number reference, view the following tables:
| Ones | |
|---|---|
| 0ドル$ | zero |
| 1ドル$ | one |
| 2ドル$ | two |
| 3ドル$ | three |
| 4ドル$ | four |
| 5ドル$ | five |
| 6ドル$ | six |
| 7ドル$ | seven |
| 8ドル$ | eight |
| 9ドル$ | nine |
| Teens | |
|---|---|
| 11ドル$ | eleven |
| 12ドル$ | twelve |
| 13ドル$ | thirteen |
| 14ドル$ | fourteen |
| 15ドル$ | fifteen |
| 16ドル$ | sixteen |
| 17ドル$ | seventeen |
| 18ドル$ | eighteen |
| 19ドル$ | nineteen |
| Tens | |
|---|---|
| 10ドル$ | ten |
| 20ドル$ | twenty |
| 30ドル$ | thirty |
| 40ドル$ | forty |
| 50ドル$ | fifty |
| 60ドル$ | sixty |
| 70ドル$ | seventy |
| 80ドル$ | eighty |
| 90ドル$ | ninety |
Powers of Ten
Also note that if a number is negative, the word "negative" should be prepended to the front of the resulting written number.
The first line of input will be an integer 1ドル \leq N \leq 1,000円,ドル the number of numbers you are to convert to English word(s) The next $N$ lines will each contain an integer $X_i$ in the range $[-9,999円,999,円 9,999円,999円],ドル the $i^\text{th}$ number you are to convert. Numbers are guaranteed to be integers.
The program should output $N$ lines, with the $i^\text{th}$ line containing the English word(s) for the number $X_i$ from the input.
4 0 5 10 18
zero five ten eighteen
4 -93564 234 -1 1234567
negative ninety-three thousand five hundred sixty-four two hundred thirty-four negative one one million two hundred thirty-four thousand five hundred sixty-seven
4 400 401 410 411
four hundred four hundred one four hundred ten four hundred eleven
4 50 1111 80 100
fifty one thousand one hundred eleven eighty one hundred
School > CS@Mines > CS@Mines HSPC 2023 > Beginner I번