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" 的使用与英国标准一致。
#include <stdio.h> #include <stdbool.h> int a[101] = {0,3,3,5,4,4,3,5,5,4,3,6,6,8,8,7,7,9,8,8}; void init(void) //初始化数组 { a[20] = 6; a[30] = 6; a[40] = 5; a[50] = 5; a[60] = 5; a[70] = 7; a[80] = 6; a[90] = 6; a[100] = 7; } int within100(void) //计算1~99所含字母的和 { int i, sum, t; t = sum = 0; for(i = 1; i <= 9; i++) t += a[i]; for(i = 1; i <= 19; i++) sum += a[i]; for(i = 2; i <= 9; i++) { sum += a[i*10] * 10; sum += t; } return sum; } void solve(void) { int i; int sum, t; sum = t = within100(); for(i = 1; i < 10; i++) { sum += (a[i] + 10) * 99 + (a[i] + 7) + t; } sum += 11; printf("%d\n",sum); } int main(void) { init(); solve(); return 0; }
Answer:
|
21124 |
Completed on Sun, 17 Nov 2013, 16:30
相关推荐
在dataframe中value_counts,只计算个数,现增加百分比和累计百分比
void countLetters(const string& word, vector<int>& letterCounts) { for (char c : word) { letterCounts[c - 'a']++; // 假设只包含小写字母 } } // 函数用于查找最大最小值 pair, int> findMinMax(const ...
Middle school Math Tournament 2019 State Round Competition
"dex-method-counts-master.zip" 文件提供了一种工具,用于查询Java或Kotlin编译后的.jar或安卓APK中的方法数量。这个工具对于优化应用、避免Dalvik VM(或ART)的65536方法限制,以及理解代码复杂性都是十分有用的...
`dex-method-counts.jar`是一个非常实用的工具,它能帮助开发者统计APK中包含的方法数量,这对于理解和优化APK的性能至关重要。这个工具的使用方法简单,只需要通过Java运行时环境执行一个命令即可。 首先,我们要...
网上收集的分享下
"利用dex-method-counts-master查看app方法数量"这个主题主要涉及到Android应用的Dalvik Executable (DEX) 文件、方法计数、以及如何通过第三方工具进行分析。 首先,了解DEX文件。在Android系统中,Java源代码被...
dex-method-counts jar包以及脚本文件(下载后需要自行修改路径),脚本文件使用可查看https://blog.csdn.net/weixin_41122292/article/details/112982576
用于计算apk方法数
获取apk 方法数。 运行: cmd 窗口中输入 java -jar dex-method-counts.jar xxx.apk>xxx.txt [三个使用到的文件,都需要绝对路径!]
### pandas计数 value_counts() 的使用详解 在数据分析领域,`pandas` 是一个非常重要的 Python 库,它提供了高效的数据结构以及数据处理工具。其中一个常用的功能是 `value_counts()` 方法,它可以用来统计数据...
Write a method that counts the number of letters in a string using the following header: public static int countLetters (String s) Write a test program that prompts the user to enter a string and ...
获取apk包含的方法数 直接在包含该 jar的文件夹打开命令行; 运行 java -jar a.jar path/to/b.apk; path/to/b.apk 是到apk的路径;
PKU_3786Adjacent Bit Counts
Given a specified total t and a list of n integers, find all distinct sums using numbers from the list that add up ... and a single number counts as a sum.) Your job is to solve this problem in general.
$ meteor add cottz:counts 快速开始 // server Meteor . publish ( 'users' , function ( ) { var cursor = Meteor . users . find ( ) ; Counts . create ( cursor , 'users' , 5000 ) . publish ( this ) ; ...
Write a method that counts the number of letters in a string using the following header: public static int countLetters (String s) Write a test program that prompts the user to enter a string and ...
【美赛2018E题优秀论文——“气候计数!减少脆弱性与更好的国家”】 这篇论文探讨了气候变化对所谓“脆弱”国家的影响,以及如何通过建立模型来量化这种影响并提出有效的国家干预措施。以下是论文的主要知识点: ...
In particular, ARGS is a demonstration of the NARGIN function, which counts command line arguments and the VARARGIN function, which allows the user to specify that a routine has a variable number of ...