马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 欧拉计划 于 2023-8-19 03:39 编辑
题目17:统计1~1000的所有英文单词的字符个数
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(包含 1000)用英文写出,那么一共需要多少个字母呢?
注意:空格和连字符不算在内。例如,342 (three hundred and forty-two) 包含 23 个字母; 115 (one hundred and fifteen) 包含 20 个字母。"and" 的使用与英国标准一致。
视频讲解:
思路解析及源码参考(C & Python):
|