Fixing Figures

면접 대비

시간 제한1초메모리 제한2048 MB

요약
음수일 수도 있는 정수를 백만 단위까지 영어 단어로 바꾸고, 십의 자리와 일의 자리가 붙으면 하이픈을 넣는다.
난이도

쉬움10점 중 3점

유형
구현, 문자열, 수학
정답자
아직 제출이 없습니다

문제

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, 52805280 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 4545 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
00zero
11one
22two
33three
44four
55five
66six
77seven
88eight
99nine
Teens
1111eleven
1212twelve
1313thirteen
1414fourteen
1515fifteen
1616sixteen
1717seventeen
1818eighteen
1919nineteen
Tens
1010ten
2020twenty
3030thirty
4040forty
5050fifty
6060sixty
7070seventy
8080eighty
9090ninety

Powers of Ten

10210^2hundred
10310^3thousand
10610^6million

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≤N≤1,0001 \leq N \leq 1\\,000, the number of numbers you are to convert to English word(s) The next NN lines will each contain an integer X_iX\_i in the range \[−9,999,999,9,999,999]\[-9\\,999\\,999, 9\\,999\\,999], the ithi^\text{th} number you are to convert. Numbers are guaranteed to be integers.

출력

The program should output NN lines, with the ithi^\text{th} line containing the English word(s) for the number X_iX\_i from the input.

예제4

  1. 예제 1

    입력
    4
    0
    5
    10
    18
    
    예상 출력
    zero
    five
    ten
    eighteen
    
  2. 예제 2

    입력
    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
    
  3. 예제 3

    입력
    4
    400
    401
    410
    411
    
    예상 출력
    four hundred
    four hundred one
    four hundred ten
    four hundred eleven
    
  4. 예제 4

    입력
    4
    50
    1111
    80
    100
    
    예상 출력
    fifty
    one thousand one hundred eleven
    eighty
    one hundred