文章目錄

原题链接 http://projecteuler.net/problem=17

Number letter counts

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”是遵循英国写法。

解答:

这题没什么好说的,就是数字转化为英文单词。

打赏作者

文章目錄