If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.

If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used?

 

NOTE: Do not count spaces or hyphens. For example, 342 (three hundred and forty-two) contains 23 letters and 115 (one hundred and fifteen) contains 20 letters. The use of "and" when writing out numbers is in compliance with British usage.

 

1에서 5까지 숫자를 영어 단어로 적으면 one, two, three, four, five이며, 여기에는 총 3+3+5+4+4=19개의 글자가 사용되었다. 1에서 1000(one thousand)까지 숫자가 영어 단어로 적혀 있으면, 몇 개의 글자가 사용되는가?

 

주의: 빈칸, 하이픈은 세지 마시오. 예를 들어, 342(three hundred and forty-two)에는 23개 글자가 있으며, 115(one hundred and fifteen)에는 20개 글자가 있다. "and"는 영국식 영어에서 숫자를 셀 때 사용하는 것에 따른다.

--------------------------------------------------------------------------

처음으로 딕셔너리를 이용하여 문제를 해결하였다. 문제 자체는 20까지 각 숫자, 30 등 십단위, 백, 천까지 사전에 넣고 반복문과 조건문을 이용하면 되는 것이어서, 신경을 조금 써야되지만 까다로운 문제는 아니었는데 학교에서 미국식 영어로 배웠던 덕분에 'and'가 들어가는 규칙을 확인하는 것이 더 까다로운 부분이었다.

 

ㄱ솔직히 이야기하면 문제 해결하는 시간만큼 숫자 딕셔너리 작성하는 데 시간이 소요되었다.

+ Recent posts